API Error: You are not permitted to view the requested resource


(Erik Chan) #1

I am receiving the following error:

{"errors"=>["You are not permitted to view the requested resource."], "error_type"=>"invalid_access"}

when I make the ruby API call ‘category_latest_topics’

response = client.category_latest_topics("<some_category>") 

This is due to the category permissions (the category is not public). I tried to authenticate by using

client.api_username = "system"  

and making sure “system” is a member of the group that has permissions to the category but still no luck! Any suggestions or workarounds?

(Erik Chan) #2

No response so far. Am I posting this in the right forum?

(Jeff Atwood) #3

Try using a different user, other than System. Issue an API key for a different user. You will need to experiment.

(Erik Chan) #4

No luck. Tried issuing API key for different users who have permission to the category but still no access.

(Erik Chan) #5

Would be awesome if anyone else has suggestions for this?

How can I access a private category via the API. This should not be an issue for users/system with admin rights to the forum.

(Chenny408) #6

I’m having the same issue, can someone take a look into this?

(mountain) #7

Have you attempted to generate a key from your account? You are the admin who created the forum, yes? You say “users/system” so I am wondering if you tried your own account.

(Erik Chan) #8

Yes i am the admin of my forum.

I have tried both my username and system with no luck. I can’t call client.category_latest_topics(<category_name>) even though the user has permissions to the category

(mountain) #9

I feel some other variable exists and is causing this error; one that cannot be seen due to the limited info provided.

Be sure to check these topics in regards to setting up and using the Discourse API, if you have not yet done so.

(Erik Chan) #10

Appreciate your help. If you read my original post i am using the ruby api. I have also looked through the documentation before posting this topic.

If you could show me what variable i am missing or where to exactly to find out more i would appreciate it.