Categories.json API not returning Lounge and Staff categories

(Mark Alldritt) #1

I’m trying to use the categories.json API end point to obtain the categories in my forum. I returns all the top level categories except for Lounge and Staff. My account has access to these categories.

I’m GETing

Is this just how it works, or do I need to specify additional information to get all the categories my Discourse account has access to?

I’m running: v2.2.0.beta2 +115

(Simon Cossar) #2

You should be able to get the Staff and Lounge categories from /categories.json. Make sure the user whose API key you are using has permission to view the Staff and Lounge categories.

(Mark Alldritt) #3

Thanks for the response. I’m using my username for the API calls and I’m the site admin. I have access to these categories when I use my site interactively.

(Blake Erickson) #4

Without using the api can you just browse to this page as a logged in user

and see Staff and Lounge? I assume so since

Do they still show up if you visit the .json version from a web browser?

So far I’m unable to replicate your behaviour.

If you do:

curl -I

do you get a 404 response?

Try the same call with your api key/username

curl -I

Do you get still get a 404?

(Blake Erickson) #5

Ohh I see you are trying to do this from iOS Shortcuts:

I think the problem might be that you have put the api_key and api_username in the Headers field.

We don’t read normal api_keys and api_username out of the headers field, so I think your request is showing up as a non-authenticated user.

Are you able to put the api_key and api_username in the URL field?

(Mark Alldritt) #6

Thanks, good spotting. I have some AppleScript code that generates the GET URL correctly and that returns all the categories.

(system) #7

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.