"Resource Not Found" message received when sending a query to Keen IO API

2.6k views Asked by At

I am using Advanced REST Client tool to test a data pull from the Keen IO API, and think getting the request right, but not getting the data. Getting "resource not found" error. This can also be done via CURL.

Headers: Authorization: Content-Type: application/json

actual request: GET /3.0/projects//queries/saved/Sponsorships/result HTTP/1.1 HOST: api.keen.io authorization: content-type: application/json

Base URL used: https://api.keen.io

Any ideas as to what may be doing wrong?

2

There are 2 answers

0
Masoud Safi On BEST ANSWER

The saved query name is capitalized "Sponsorships". Make sure your saved query name is lower-cased, not camel or title-cased. To be sure that you are getting the correct saved query name.

Also, you may want to first obtain a list of all saved queries as a reference:

GET /3.0/projects/<project_name>/queries/saved HTTP/1.1
HOST: api.keen.io
authorization: <your_key>
content-type: application/json

You will get something like this:

[ { "refresh_rate": 0, "last_modified_date": "2016-12-20T01:09:54.355000+00:00", "query_name": "", "created_date": "2016-12-20T01:09:54.355000+00:00", "query": { "filters": [], "latest": 100, "analysis_type": "extraction", "timezone": "UTC", "timeframe": "this_30_days", "event_collection": "" }, "metadata": { "visualization": { "chart_type": "table" }, "display_name": "" }, "run_information": null } ]

0
kip2 On

FWIW, I also have seen the "Resource not found" error when writing data to an event if the project is not correctly set up. For example, passing in the wrong project_id or write_key or if the project was deleted from your Keen.io account.