API: Retrieving information about a specific Product

Hi all,

I’m trying to get my Product information by requesting:
GET /products/:product_id

I get a 404 response:
{
“ok”: false,
“error”: “Organization not found for user’s role.”
}

I’m using a valid access token that works fine when getting the list of all products, i.e. GET /products which lists the products successfully (this is where I get the product_id above).

So I’m wondering why GET /products/product_id seem to have a more restricted access compared to GET /products which essentially exposes the same information.

If anyone’s encountered this, I’d appreciate suggestions on how to get around it.

Thank you!

Arian

Hey Arian,

Sorry to hear that you are having these problems. Let me ping one of my engineers @bryce and an Elite @Hypnopompia who I think might be able to help with this.

Kyle

In order to use the product-specific APIs, you need to have an access token for that product.

curl https://api.particle.io/oauth/token -u "tempmon06-3459:460edfd8d70742dd1f1e75c3d5cac5973351465d" -d grant_type=client_credentials 

Where:

  • tempmon06-3459 is the clientID from the Authentication tab for your product. It must be a full permissions client ID.
  • 460edfd8d70742dd1f1e75c3d5cac5973351465d is the secret access token you created when you created that client ID.

(Those aren’t real tokens, by the way, you need to keep those secret.)

You get back an access token and that’s what you pass in access_token for the product endpoint, not the one from your regular account.

3 Likes

Thank you @KyleG and @rickkas7 for the quick response!

I’ll try this soon and let you know how it went.

Cheers,

Arian

1 Like