hello everyone!
I'm trying to connect app-search to postman: while using the Dev Tools in kibana i tried with POST and got the following error:
Request:
GET 'http://localhost:3002/api/as/v1/engines/iot/search.json ' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer [API_KEY]' \
-d '{
"page": {
"current": 2,
"size": 15
}
}'
Response:
{
"error" : "no handler found for uri [/'http%3A//localhost%3A5601/api/as/v1/engines/iot/search.json'?pretty=true] and method [GET]"
}
and if i access this "http://localhost:3002/api/as/v1/engines/iot/search.json " on my browser i get the following error:
"Missing required parameter: query"
Please if you have any recommendations??
Hi @Ines_ZAYANI ,
You can't use Kibana Dev Tools to query the App Search API. But you can use either curl, or Postman. Postman does have a great UI that makes things easier.
With curl, you would issue the command in your terminal console as follows:
curl -XGET "http://localhost:3002/api/as/v1/iot/search" \
-H 'Authorization: Bearer [API_KEY]' \
-H 'Content-Type: application/json' \
-d '{"query": "blah", "page": {"current": 1, "size": 10}}'
You must specify the query
. This is not optional. This is why you get the error message when you open that URL in the browser.
See the documentation page here:
You can' however, specify an empty string, if you want all documents back.
With Postman, you would fill in authorization, provide the URL and query body:
By the way, there's no need to attach json
suffix to search
endpoint.
I hope this helps.
1 Like
Which one of the api keys put on postman for doing the Authorization
Thanks @Irina_Truong that was actually very helpfull i tried with postman and everything worked out very well.
You can use search key, private key, basic auth (username / password), any of those methods will work with the search
endpoint.
1 Like
system
(system)
Closed
May 27, 2022, 10:21pm
8
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.