# API documentation error?

**URL:** https://meta.discourse.org/t/api-documentation-error/97624
**Category:** Development
**Created:** [September 20, 2018, 7:43am UTC](https://meta.discourse.org/t/api-documentation-error/97624 "2018-09-20T07:43:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Julian\_Elve](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/julian_elve/32/119540_2.png) [@Julian\_Elve](https://meta.discourse.org/u/Julian_Elve)
#### Post date: [September 20, 2018, 7:43am UTC](https://meta.discourse.org/t/api-documentation-error/97624/1 "2018-09-20T07:43:46Z")

</div>

At [this page](https://docs.discourse.org/#tag/Users%2Fpaths%2F~1admin~1users~1%7Bid%7D.json%2Fget) the documentation states that detailed record for user can be obtained by `GET /admin/users/{id}.json `

Tests suggest this is not correct (returns 404) and the correct URL is `GET /admin/users/{id}/{username}.json `

Should I do a PR on the docs repo? Or do the team consider that the API expresses what the API _should_ do, so this is actually an API bug?

Julian

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [September 20, 2018, 8:12am UTC](https://meta.discourse.org/t/api-documentation-error/97624/2 "2018-09-20T08:12:36Z")

</div>

I think you should revisit your tests. The first path works fine _as long as it is a valid member id number_

In fact, AFAIK, it is the only path that works with the account number and not the member name.

---

<div class="post-metadata">

### Author: ![Julian\_Elve](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/julian_elve/32/119540_2.png) [@Julian\_Elve](https://meta.discourse.org/u/Julian_Elve)
#### Post date: [September 20, 2018, 8:19am UTC](https://meta.discourse.org/t/api-documentation-error/97624/3 "2018-09-20T08:19:21Z")

</div>

Sorry @Mittineague I’m absolutely positive. Maybe this is a version change? I am running against Discourse 2.1.1

You can also see it -in the UI - when you look at details of a user they appear at  
`<mysite.com>//admin/users/{userid}/{username}` while `<mysite.com>//admin/users/{userid}/` is a 404

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [September 20, 2018, 8:52am UTC](https://meta.discourse.org/t/api-documentation-error/97624/4 "2018-09-20T08:52:04Z")

</div>

You have a few variations there. These work for me.  
Discourse 2.2.0.beta2  
`.../admin/users/{userid}.json`  
`.../admin/users/{userid}/{username}`  
`.../admin/users/{userid}/{username}.json`

---

<div class="post-metadata">

### Author: ![Julian\_Elve](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/julian_elve/32/119540_2.png) [@Julian\_Elve](https://meta.discourse.org/u/Julian_Elve)
#### Post date: [September 20, 2018, 9:05am UTC](https://meta.discourse.org/t/api-documentation-error/97624/5 "2018-09-20T09:05:23Z")

</div>

> [@Mittineague](#):
>
> …/admin/users/{userid}.json

That one works for me too. I’ve been ignoring the `.json` suffix and just using the header [as documented](https://docs.discourse.org/)

> Instead of sending API requests to `/categories.json` you may also send them to `/categories` and add an `Accept: application/json` header to the request to get the JSON response. Sending requests with the `Accept` header is necessary if you want to use URLs for related endpoints returned by the API, such as pagination URLs. These URLs are returned without the `.json` prefix so you need to add the header in order to get the correct response format.

but maybe I need to change my code to use it.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [September 20, 2018, 9:26am UTC](https://meta.discourse.org/t/api-documentation-error/97624/6 "2018-09-20T09:26:40Z")

</div>

Routing is different for different paths. Do you have the Ember addon installed in your browser?

> **[Installing the Inspector - Ember Inspector - Ember Guides](https://guides.emberjs.com/release/ember-inspector/installation/)**
>
> You can install the Inspector on Google Chrome, Firefox, other browsers (via a bookmarklet), and on mobile devices by following the steps below. Google Chrome 
> 
> You can install the Inspector on Google Chrome as a new Developer Tool. To begin, visit...

---

<div class="post-metadata">

### Author: ![Julian\_Elve](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/julian_elve/32/119540_2.png) [@Julian\_Elve](https://meta.discourse.org/u/Julian_Elve)
#### Post date: [September 20, 2018, 9:29am UTC](https://meta.discourse.org/t/api-documentation-error/97624/7 "2018-09-20T09:29:02Z")

</div>

> [@Mittineague](#):
>
> Routing is different for different paths. Do you have the Ember addon installed in your browser?

I have now - so this is about [reverse engineering the API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576)?
