Question

I have created a new collection and have added few entities to this collection in the APIGEE BaaS. I am able to run GET query using the admin portal.

I am trying to invoke the same using my REST client.

I am using the following URL: https://api.usergrid.com/myOrg/myapp/mycollection

However, I get below error:

{
    "error": "unauthorized",
    "timestamp": 1401855388323,
    "duration": 1,
    "exception": "org.apache.shiro.authz.UnauthorizedException",
    "error_description": "Subject does not have permission [applications:get:xxxxxxxxxxx]"
}

I believe I need to add authorization information in the HTTP header for the request. But am unable to find information on what is expected.

How can I invoke the BaaS API?

Was it helpful?

Solution

This is happening because you don't have permission to access the collection without authentication (or in some cases, your authentication token may not have appropriate permission to access that particular collection.

You can read about managing permissions & roles in the Apigee docs.

There are a couple quick ways to solve your problem though:

  1. (The most prevalent) is to authenticate your user account and use an appropriate access token (e.g. https://api.usergrid.com/myOrg/myapp/mycollection?access_token=<token>)

  2. While it's not something you should be doing on the client side, for server-side requests or testing purposes, you can use your app or org-level client_id/client_secret in a similar manner (e.g. https://api.usergrid.com/myOrg/myapp/mycollection?client_id=<id>&client_id=<secret>)

  3. Give the Guest role access to your collection (here's a link to the docs)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top