# API for Admin Report Data

**URL:** https://meta.discourse.org/t/api-for-admin-report-data/242426
**Category:** Development
**Tags:** rest-api
**Created:** [October 20, 2022, 12:08am UTC](https://meta.discourse.org/t/api-for-admin-report-data/242426 "2022-10-20T00:08:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![codetricity](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codetricity/32/3773_2.png) [@codetricity](https://meta.discourse.org/u/codetricity)
#### Post date: [October 20, 2022, 12:08am UTC](https://meta.discourse.org/t/api-for-admin-report-data/242426/1 "2022-10-20T00:08:35Z")

</div>

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

This [post](https://meta.discourse.org/t/api-get-count-of-latest/91580/2) 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](https://docs.discourse.org/) 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.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [October 20, 2022, 12:47am UTC](https://meta.discourse.org/t/api-for-admin-report-data/242426/2 "2022-10-20T00:47:41Z")

</div>

> [@codetricity](#):
>
> 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 ?

---

<div class="post-metadata">

### Author: ![codetricity](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codetricity/32/3773_2.png) [@codetricity](https://meta.discourse.org/u/codetricity)
#### Post date: [October 20, 2022, 3:48pm UTC](https://meta.discourse.org/t/api-for-admin-report-data/242426/3 "2022-10-20T15:48:02Z")

</div>

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

```plaintext
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](https://docs.discourse.org/) site.

Thanks again.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [October 21, 2022, 7:44pm UTC](https://meta.discourse.org/t/api-for-admin-report-data/242426/4 "2022-10-21T19:44:39Z")

</div>

I just did a test on Meta with

```plaintext
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?

---

<div class="post-metadata">

### Author: ![codetricity](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codetricity/32/3773_2.png) [@codetricity](https://meta.discourse.org/u/codetricity)
#### Post date: [October 21, 2022, 11:15pm UTC](https://meta.discourse.org/t/api-for-admin-report-data/242426/5 "2022-10-21T23:15:20Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [November 20, 2022, 11:16pm UTC](https://meta.discourse.org/t/api-for-admin-report-data/242426/6 "2022-11-20T23:16:12Z")

</div>

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