|
| 1 | +# Users |
| 2 | +Supports registering, viewing, and updating user accounts. |
| 3 | + |
| 4 | +## Register a new user account |
| 5 | + |
| 6 | +**Request**: |
| 7 | + |
| 8 | +`POST` `/users/` |
| 9 | + |
| 10 | +Parameters: |
| 11 | + |
| 12 | +Name | Type | Required | Description |
| 13 | +-----------|--------|----------|------------ |
| 14 | +username | string | Yes | The username for the new user. |
| 15 | +password | string | Yes | The password for the new user account. |
| 16 | +first_name | string | No | The user's given name. |
| 17 | +last_name | string | No | The user's family name. |
| 18 | +email | string | No | The user's email address. |
| 19 | + |
| 20 | +*Note:* |
| 21 | + |
| 22 | +- Not Authorization Protected |
| 23 | + |
| 24 | +**Response**: |
| 25 | + |
| 26 | +```json |
| 27 | +Content-Type application/json |
| 28 | +201 Created |
| 29 | + |
| 30 | +{ |
| 31 | + "id": "6d5f9bae-a31b-4b7b-82c4-3853eda2b011", |
| 32 | + "username": "richard", |
| 33 | + "first_name": "Richard", |
| 34 | + "last_name": "Hendriks", |
| 35 | + |
| 36 | + "auth_token": "132cf952e0165a274bf99e115ab483671b3d9ff6" |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +The `auth_token` returned with this response should be stored by the client for |
| 41 | +authenticating future requests to the API. See [Authentication](authentication.md). |
| 42 | + |
| 43 | + |
| 44 | +## Get a user's profile information |
| 45 | + |
| 46 | +**Request**: |
| 47 | + |
| 48 | +`GET` `/users/:id` |
| 49 | + |
| 50 | +Parameters: |
| 51 | + |
| 52 | +*Note:* |
| 53 | + |
| 54 | +- **[Authorization Protected](authentication.md)** |
| 55 | + |
| 56 | +**Response**: |
| 57 | + |
| 58 | +```json |
| 59 | +Content-Type application/json |
| 60 | +200 OK |
| 61 | + |
| 62 | +{ |
| 63 | + "id": "6d5f9bae-a31b-4b7b-82c4-3853eda2b011", |
| 64 | + "username": "richard", |
| 65 | + "first_name": "Richard", |
| 66 | + "last_name": "Hendriks", |
| 67 | + |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | + |
| 72 | +## Update your profile information |
| 73 | + |
| 74 | +**Request**: |
| 75 | + |
| 76 | +`PUT/PATCH` `/users/:id` |
| 77 | + |
| 78 | +Parameters: |
| 79 | + |
| 80 | +Name | Type | Description |
| 81 | +-----------|--------|--- |
| 82 | +first_name | string | The first_name of the user object. |
| 83 | +last_name | string | The last_name of the user object. |
| 84 | +email | string | The user's email address. |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +*Note:* |
| 89 | + |
| 90 | +- All parameters are optional |
| 91 | +- **[Authorization Protected](authentication.md)** |
| 92 | + |
| 93 | +**Response**: |
| 94 | + |
| 95 | +```json |
| 96 | +Content-Type application/json |
| 97 | +200 OK |
| 98 | + |
| 99 | +{ |
| 100 | + "id": "6d5f9bae-a31b-4b7b-82c4-3853eda2b011", |
| 101 | + "username": "richard", |
| 102 | + "first_name": "Richard", |
| 103 | + "last_name": "Hendriks", |
| 104 | + |
| 105 | +} |
| 106 | +``` |
0 commit comments