Discourse API Reports

AI-generated summary

Discourse API Reports Discussion Summary

jordan1909 is trying to use the Discourse API’s reporting functionality in a Node app on a different server but is getting a 404 error. codinghorror suggests rebuilding the docs site, but blake clarifies that the issue is with the endpoint URL being documented incorrectly.

jordan1909 tries the corrected endpoint but gets a raw dump of the page instead of JSON data. david suggests adding .json to the end of the URL, which resolves the issue initially, but jordan1909 encounters a 404 error again when making external API calls.

david asks if jordan1909 is including an API key in the Postman request. jordan1909 realizes the mistake was a typo in the API key parameter name, using ap_key instead of api_key.

Hello!
I am trying to use the reporting functionality found in the Discourse api via a node app on a different server.

When I issue my requests (whether on the server or in postman) I get a 404 that the url was not found?

Is this function depreceated or still around? Can’t seem to figure it out.

Do we need to rebuild the docs.discourse.org site @blake?

No the doc site is working just fine, but the url for that endpoint may have been documented wrong :blush:.

@jordan1909 can you try hitting this endpoint on your site?

Looks like you will need to include /admin/reports and all correct params

@blake

So this works in my browser but I need to get the JSON data back for usage elsewhere and everytime I issue the query anywhere else I get a raw dump of the page?

Any idea what I’m missing? Issuing a GET request here.

Postman URL

Try adding .json to the end of the URL

@david

I :heart: you

I had previously marked this as solved however if I execute the request via Postman or in an Ajax query I am getting a 404. Is this available to the api for external calls? Am I missing something?

Does anyone have an example of getting this value via an Ajax request or even Postman?

Are you including an API key in your postman request?

@david

Clearly I have been staring at my screen too long. :man_facepalming:

I take it the value is api_key not ap_key.

I’ll go hide in the corner and think about what I’ve done.