RESTful web API Documentation Generator
This is the content of the header.md file.
- User
- Change a User
- Create a new User
- Delete user
- Read data of a User
- Thank a user: this is quite a long name indeed
this quote is prepended to this doc using a file
prepend.md
This function has same errors like POST /user, but errors not defined again, they were included with "apiErrorStructure"
PUT /user/:id
| Name | Type | Description |
|---|---|---|
| id | Number |
|
| Name | Type | Description |
|---|---|---|
| name | String |
Name of the User. |
| avatar | File |
Upload avatar. |
| Name | Type | Description |
|---|---|---|
| NoAccessRight | Only authenticated Admins can access the data. |
|
| UserNameTooShort | Minimum of 5 characters required. |
HTTP/1.1 400 Bad Request
{
"error": "UserNameTooShort"
}In this case "apiErrorStructure" is defined and used. Define blocks with params that will be used in several functions, so you dont have to rewrite them.
POST /user
| Name | Type | Description |
|---|---|---|
| age | Number |
Age of the User |
| name | String |
Name of the User Default value: Caroline |
| extraInfo.hireDate | Date |
Date when user was hired |
| extraInfo.hireDateWithDefault | Date |
Date when user was hired with default Default value: 2021-09-01 |
| extraInfo.nickname | String |
Nickname of the user |
| extraInfo.isVegan | Boolean |
Is the user vegan? (boolean with default) Default value: true |
| extraInfo.isAlive | Boolean |
Is the user alive? (boolean with no default) |
| extraInfo.secrets.crush | String |
The user secret crush |
| extraInfo.secrets.hair | Number |
Number of hair of user Default value: 1000 |
| Name | Type | Description |
|---|---|---|
| id | Number |
The new Users-ID. |
| Name | Type | Description |
|---|---|---|
| NoAccessRight | Only authenticated Admins can access the data. |
|
| UserNameTooShort | Minimum of 5 characters required. |
HTTP/1.1 400 Bad Request
{
"error": "UserNameTooShort"
}Be careful! This will remove all the data associated with that user!
DELETE /user/:id
| Name | Type | Description |
|---|---|---|
| Authorization | String |
The token can be generated from your user profile. |
Header-Example
"Authorization: token 5f048fe"
| Name | Type | Description |
|---|---|---|
| id | Number |
|
Curl example
curl -X DELETE -H "Authorization: token 5f048fe" -i https://api.example.com/user/4711Javascript example
const client = AcmeCorpApi('5f048fe');
const user = client.deleteUser(42);Python example
client = AcmeCorpApi.Client(token="5f048fe")
user = client.delete_user(42)| Name | Type | Description |
|---|---|---|
| result | String |
|
| nullableField | String |
optional This response field is not always there (can be null). |
HTTP/1.1 200 OK
{
"result": "ok"
}| Name | Type | Description |
|---|---|---|
| NoAccessRight | Only authenticated Admins can access the data. |
|
| UserNotFound | The |
| Name | Type | Description |
|---|---|---|
| InternalServerError | The server encountered an internal error. |
HTTP/1.1 401 Not Authenticated
{
"error": "NoAccessRight"
}Compare version 0.3.0 with 0.2.0 and you will see the green markers with new items in version 0.3.0 and red markers with removed items since 0.2.0.
GET /user/:region/:id/:opt
| Name | Type | Description |
|---|---|---|
| Authorization | String |
The token can be generated from your user profile. |
| X-Apidoc-Cool-Factor | String |
Some other header with a default value. |
Header-Example
"Authorization: token 5f048fe"
| Name | Type | Description |
|---|---|---|
| id | Number |
User unique ID |
| region | String |
User region Default value: fr-par |
| opt | String |
optional An optional param |
Curl example
curl -H "Authorization: token 5f048fe" -i https://api.example.com/user/fr-par/4711
curl -H "Authorization: token 5f048fe" -H "X-Apidoc-Cool-Factor: superbig" -i https://api.example.com/user/de-ber/1337/yepJavascript example
const client = AcmeCorpApi('5f048fe');
const user = client.getUser(42);Python example
client = AcmeCorpApi.Client(token="5f048fe")
user = client.get_user(42)| Name | Type | Description |
|---|---|---|
| id | Number |
The Users-ID. |
| registered | Date |
Registration Date. |
| name | String |
Fullname of the User. |
| nicknames | String[] |
List of Users nicknames (Array of Strings). |
| profile | Object |
Profile data (example for an Object) |
| profile.age | Number |
Users age. |
| profile.image | String |
Avatar-Image. |
| options | Object[] |
List of Users options (Array of Objects). |
| options.name | String |
Option Name. |
| options.value | String |
Option Value. |
| Name | Type | Description |
|---|---|---|
| NoAccessRight | Only authenticated Admins can access the data. |
|
| UserNotFound | The |
| Name | Type | Description |
|---|---|---|
| InternalServerError | The server encountered an internal error |
HTTP/1.1 401 Not Authenticated
{
"error": "NoAccessRight"
}This is here to have a long name in the left menu.
POST /user/:id
This is the content of the footer.md file.