Forum Discussion
AdamN
13 years agoKhoros Oracle
Hi ajoshi84,
Each request to the REST API is made either as an anonymous user or as a registered user, and as such the request is subject to the permissions granted to that particular user. Judging by the response you received, it appears that the request was made as an anonymous user ("UserRef[id=-1]"), and it also appears that the anonymous user does not have permission to make REST API calls with read access in the community ("does not have access to RequiredPermissions[(allow_restapi_call_read)]")
You have a couple of options:
- You can alter the default community permission for "Make REST API calls with read access" to grant. The permissions for the anonymous user are essentially the default permissions you've set in the community, so granting this permission allows anonymous users (or any user for that matter) to make REST API calls with read access.
- You can authenticate as a user that has been explicitly granted the permission "Make REST API calls with read access". Check out the "AuthenticationManager" class in the javadocs for more information on how to login via the REST API. You'll need to make sure you keep the session key that is returned when you login and then pass it to the subsequent requests via the "restapi.session_key" query string parameter. If you go this route, I'd suggest registering an account specifically dedicated to making REST API requests.
Personally, I'm more a fan of option #2 because it only grants access to the accounts that need it, but I also understand that different communities have different needs.
I hope this helps!
Related Content
- 5 years ago
- 16 years ago
- 4 years ago
- 6 months ago
- 4 years ago