Trouble WIth API Call to Get Project Devices

New user here. I am using the Notehub API for the first time. I have successfully implemented the OAuth call to get an access token.

I am getting this back from the OAuth call:

access_token : GdeskJ5F8uzCmnM2lFDVI_kHa6xVm-182B2XuJyJuUQ.VWmLQtZRVPyHiANFTzIxw_ds4oB__bbmYnPWnEnre0s
expires_in : 1799
scope :
token_type : bearer

Immediately after that successful OAuth call, I call the projects/devices endpoint to retrieve the devices in my project.

I am setting the “Authorization” request header to:

Bearer {GdeskJ5F8uzCmnM2lFDVI_kHa6xVm-182B2XuJyJuUQ.VWmLQtZRVPyHiANFTzIxw_ds4oB__bbmYnPWnEnre0s}

And the URL I am calling is:

https://api.notefile.net/v1/projects/<my.project.id>/devices

The response I am getting is “NotFound”.

It would seem that this means that it is not finding my project (the URL does not map to an existing project).

Is https://api.notefile.net/v1/projects/<my.project.id>/devices still the correct URL for this API call?

If it is, what else should I check to determine why this is not working?

Thanks,

Brad

I just did a quick check, but i couldn’t find this URL https://api.notefile.net/v1/projects/<my.project.id>/devices in the notehub API reference. It is either I missed it or it doesn’t exist. You can check for yourself at : Notehub API Introduction - Blues Developers

Thanks for the reply, Pius4109. The call I am making is a part of the Device API in the Notehub section. It is documented here: The “Get Devices” call at the top of the page.

Now I will admit that I did not specifically see the official root part of the API URL documented anywhere. I just used the URL format shown i the CURL command assuming it would be the same. But that too may be a flawed assumption. I will look again for official documentation.

I chose it because after a rapid and totally non-thorough scan of the docs, it was an API call that looked as simple as any as it had no arguments other than the ProjectUUID in the URL.

I think I will go scan the docs again and see if I can find another one to try. At this early stage of just familiarizing myself with the API’s and how they work, any API call will do. If you or anyone else has a suggestion for a nice, simple call to invoke in my sandbox code, I’d appreciate it!

Thanks again,

Brad

I noticed that the NotFound reply included a JSON payload.Here is what that payload contained:

OK, I figured out my problem. Definitely a first time user problem.

The problem: In constructing the URL to call, I was using the “ProductUID” instead of the “ProjectUID”.

You can find both on the Settings page for your Notehub project. Note that the ProjectUID is somewhat human readable (may start with your domain name listed in reverse), the Project UID is a cryptic machine generated UID.

Once I started using the Project UID in the URL it started working.

Issue closed.

Hope this helps someone else down the road.

2 Likes