|
| 1 | +--- |
| 2 | +title: Get User by ID |
| 3 | +description: Retrieve a single user by their unique identifier |
| 4 | +api: GET /users/{id} |
| 5 | +baseUrl: https://jsonplaceholder.typicode.com |
| 6 | +layout: '@/layouts/APIEndpointLayout.astro' |
| 7 | +--- |
| 8 | + |
| 9 | +## Overview |
| 10 | + |
| 11 | +Retrieves detailed information about a specific user by their ID. |
| 12 | + |
| 13 | +## Path Parameters |
| 14 | + |
| 15 | +<ParamTable type="path"> |
| 16 | + <Param name="id" type="integer" required> |
| 17 | + The unique identifier of the user to retrieve |
| 18 | + </Param> |
| 19 | +</ParamTable> |
| 20 | + |
| 21 | +## Response |
| 22 | + |
| 23 | +<ResponseField name="id" type="integer"> |
| 24 | + Unique identifier for the user |
| 25 | +</ResponseField> |
| 26 | + |
| 27 | +<ResponseField name="name" type="string"> |
| 28 | + Full name of the user |
| 29 | +</ResponseField> |
| 30 | + |
| 31 | +<ResponseField name="username" type="string"> |
| 32 | + Unique username |
| 33 | +</ResponseField> |
| 34 | + |
| 35 | +<ResponseField name="email" type="string"> |
| 36 | + Email address |
| 37 | +</ResponseField> |
| 38 | + |
| 39 | +<ResponseField name="address" type="object" expandable> |
| 40 | + Physical address of the user |
| 41 | + |
| 42 | + <ResponseField name="street" type="string"> |
| 43 | + Street address |
| 44 | + </ResponseField> |
| 45 | + <ResponseField name="suite" type="string"> |
| 46 | + Apartment or suite number |
| 47 | + </ResponseField> |
| 48 | + <ResponseField name="city" type="string"> |
| 49 | + City name |
| 50 | + </ResponseField> |
| 51 | + <ResponseField name="zipcode" type="string"> |
| 52 | + Postal code |
| 53 | + </ResponseField> |
| 54 | + <ResponseField name="geo" type="object"> |
| 55 | + Geographic coordinates (lat, lng) |
| 56 | + </ResponseField> |
| 57 | +</ResponseField> |
| 58 | + |
| 59 | +<ResponseField name="phone" type="string"> |
| 60 | + Phone number |
| 61 | +</ResponseField> |
| 62 | + |
| 63 | +<ResponseField name="website" type="string"> |
| 64 | + Personal website URL |
| 65 | +</ResponseField> |
| 66 | + |
| 67 | +<ResponseField name="company" type="object" expandable> |
| 68 | + Company information |
| 69 | + |
| 70 | + <ResponseField name="name" type="string"> |
| 71 | + Company name |
| 72 | + </ResponseField> |
| 73 | + <ResponseField name="catchPhrase" type="string"> |
| 74 | + Company slogan |
| 75 | + </ResponseField> |
| 76 | + <ResponseField name="bs" type="string"> |
| 77 | + Business description |
| 78 | + </ResponseField> |
| 79 | +</ResponseField> |
| 80 | + |
| 81 | +## Example Response |
| 82 | + |
| 83 | +```json |
| 84 | +{ |
| 85 | + "id": 1, |
| 86 | + "name": "Leanne Graham", |
| 87 | + "username": "Bret", |
| 88 | + "email": "Sincere@april.biz", |
| 89 | + "address": { |
| 90 | + "street": "Kulas Light", |
| 91 | + "suite": "Apt. 556", |
| 92 | + "city": "Gwenborough", |
| 93 | + "zipcode": "92998-3874", |
| 94 | + "geo": { |
| 95 | + "lat": "-37.3159", |
| 96 | + "lng": "81.1496" |
| 97 | + } |
| 98 | + }, |
| 99 | + "phone": "1-770-736-8031 x56442", |
| 100 | + "website": "hildegard.org", |
| 101 | + "company": { |
| 102 | + "name": "Romaguera-Crona", |
| 103 | + "catchPhrase": "Multi-layered client-server neural-net", |
| 104 | + "bs": "harness real-time e-markets" |
| 105 | + } |
| 106 | +} |
| 107 | +``` |
| 108 | + |
| 109 | +## Error Responses |
| 110 | + |
| 111 | +| Status | Description | |
| 112 | +|--------|-------------| |
| 113 | +| `404` | User not found - the specified ID does not exist | |
0 commit comments