API for Admin Report Data

I want to access the admin report data from an HTTP API.

This post seems to indicate that something like this will work:
/admin/reports/posts.json

I am getting an 404 error now.

All the URLs like this, do not seem to work. /admin/reports/staff_logins.json

I can run the API commands from the Discourse API Documentation fine.

My main objective is to get this report:

/admin/reports/user_notes.json

I’m using GET with the Api-Key and Api_Username of an admin account.

Can your share a cURL of the request you are currently issuing ?

Thank you for your help. Here is the curl script I am using

curl --request GET \
  --url https://community.domain.com/admin/reports/staff_logins.json \
  --header '"Api-Key": "stringForAPIKey"' \
  --header '"Api-Username": "stringForUsername"' \
  --header '"Content-Type": "application/json"'

I am getting a 404 error

Can you send me a curl script that works on your system?

I am using Discourse 2.9.0.beta10

The user is an admin.
The API key works for other API commands listed on the Discourse API Documentation site.

Thanks again.

1 Like

I just did a test on Meta with

curl https://meta.discourse.org/admin/reports/staff_logins.json \
  -H 'Api-Key: asdasdasdasd' \
  -H 'Api-Username: Falco'

and it worked just fine for me. Can you try like that?

3 Likes

@Falco Wow. You’re the man. This solved my problems.

The source of my problem was that I am using a tool called Insomnia to test the API and I don’t have much experience with Insomnia.

Thanks for helping me. I was stuck for a week and I am grateful for your assistance. This also solved a different problem I was having with the user_notes reports.

2 Likes

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