Scoping API Key for All Permissions & Searches
TLDR James requests help to scope an API key for all searches and permissions. Jason suggests adding aliases:get and metrics:get. This suggestion doesn't resolve the issue; the thread is marked as unresolved.
Sep 15, 2021 (26 months ago)
James
05:30 PM"actions": ["documents:search"], "collections": ["*"]
, which works, but the others permissions I'm unsure about.Jason
07:56 PMSep 16, 2021 (26 months ago)
James
09:59 PM^_^[james@ganymede:~]$ export TS_ADM_KEY=<REDACTED>
^_^[james@ganymede:~]$ curl '' \
> -X POST \
> -H "X-TYPESENSE-API-KEY: ${TS_ADM_KEY}" \
> -H 'Content-Type: application/json' \
> -d '{"description": "Minimal UI key", "actions": ["documents:search","metrics:get","aliases:get"], "collections": ["*"]}'
{"actions":["documents:search","metrics:get","aliases:get"],"collections":["*"],"description":"Minimal UI key","expires_at":64723363199,"id":4,"value":"<MIN_API_KEY>"}
^_^[james@ganymede:~]$
^_^[james@ganymede:~]$
^_^[james@ganymede:~]$ export MIN_API_KEY=<MIN_API_KEY>
^_^[james@ganymede:~]$ curl '' \
> -H "X-TYPESENSE-API-KEY: ${MIN_API_KEY}"
{"message": "Forbidden - a valid `x-typesense-api-key` header must be sent."}^_^[james@ganymede:~]$
^_^[james@ganymede:~]$
^_^[james@ganymede:~]$ curl '' -H "X-TYPESENSE-API-KEY: ${MIN_API_KEY}"
{"message": "Forbidden - a valid `x-typesense-api-key` header must be sent."}
^_^[james@ganymede:~]$
James
10:01 PM^_^[james@ganymede:~]$ curl '' -H "X-TYPESENSE-API-KEY: ${TS_ADM_KEY}"
{"aliases":[{"collection_name":"scimago-20210913","name":"scimago"},{"collection_name":"search-20210913","name":"search"},{"collection_name":"openurl-20210914","name":"openurl"},{"collection_name":"browse-20210913","name":"browse"},{"collection_name":"content-20210913","name":"content"}]}
^_^[james@ganymede:~]$ curl '' -H "X-TYPESENSE-API-KEY: ${TS_ADM_KEY}"
{
"system_cpu1_active_percentage": "0.00",
"system_cpu_active_percentage": "0.00",
"system_disk_total_bytes": "25832407040",
"system_disk_used_bytes": "4128784384",
"system_memory_total_bytes": "1028968448",
"system_memory_used_bytes": "479678464",
"system_network_received_bytes": "1465995489",
"system_network_sent_bytes": "256701323",
"typesense_memory_active_bytes": "178778112",
"typesense_memory_allocated_bytes": "173139992",
"typesense_memory_fragmentation_ratio": "0.03",
"typesense_memory_mapped_bytes": "193572864",
"typesense_memory_metadata_bytes": "8894784",
"typesense_memory_resident_bytes": "178778112",
"typesense_memory_retained_bytes": "198070272"
}
^_^[james@ganymede:~]$
Jason
11:01 PMTypesense
Indexed 2779 threads (79% resolved)
Similar Threads
Correct API Key Generation and Usage on Cloud
Tom faced 401 errors while creating keys via the Cloud API. Kishore Nallan clarified the correct syntax and mechanics, and identified a header mislabeling on Tom's part that caused the issue. They also discussed using scoped API keys.
Resolving Issues with Scoped API Keys in Typesense with Golang
Suvarna had problems with generating and using scoped API keys in Typesense with Golang. Several bugs misleading the user were found and fixed by Kishore Nallan.
Issues with Generating Scope API Keys in Python
Danny had issues generating a valid scope API key in a Python GraphQL server. Jason suggested encoding changes and confirmed that the key length varies. Issue unresolved with Python, although JS library worked.