Group API, empty response

AI-generated summary

Group API Issue: Empty Response

The original poster, Massimo_Redaelli, reports that their daily program fetching groups using the Discourse JSON API (GET https://disc.uaar.it/admin/groups.json?api_key=xxxx&api_username=xxx) stopped working, returning an empty response with a 200 status code.

Falco revealed that the route was moved to https://disc.uaar.it/groups/search.json. Massimo_Redaelli asked if there’s a list of modified routes, but Falco mentioned that route changes are rare.

Donavan_Martin noted that the Discourse API documentation might be outdated. Falco confirmed that the route change occurred three years ago.

Donavan_Martin shared their solution to a similar issue, which involved activating “grant permissions” for the user in Discourse settings and adding specific headers to the request.

I have a small program that daily does some work on the groups of my Discourse installation, and to do that it starts by fetching all the groups using the json API:

GET https://disc.uaar.it/admin/groups.json?api_key=xxxx&api_username=xxx

Suddenly a few days ago this call stopped working. Now I get a 200 response code (the login is OK, and there is no error in the logs), but the response is empty and its content type is text/plain.

I’m running v1.9.0.beta5 +8, but I cannot check if this happened at the same time as an upgrade, because the system admin is on vacation :stuck_out_tongue:

Any thoughs?

We moved this route to https://disc.uaar.it/groups/search.json

I see, thanks!

Is there a list of modified routes?

It’s very rare to modify routes like that, but since we had a lot of new stuff around groups, this route was needed for normal users and had to be moved from /admin scope.

Looks like this route changed too… : {{base_url}}/admin/groups

Do the Discourse’s API is up to date?Discourse API Docs

That is the exact same route OP is talking about.

It was moved 3 years ago indeed. What is the specific problem you have?

The Postman file shared by Discourse have some issues in configuration Params & Headers.

I finally got it work by activate the “grant permissions” for the user in Discourse Settings interface and by adding headers like this: