RESTful web API Documentation Generator
This is the content of the header.md
file.
- Define
- Deprecated
- Escape
- Example
- Group
- Grouping
- Header
- Language
- Clojure
- Clojure indented 1
- CoffeeScript
- CoffeeScript indented 1
- CoffeeScript indented 2
- Erlang
- Erlang indented 1
- Erlang indented 2
- JavaScript
- JavaScript indented 1
- JavaScript indented 2
- Perl
- Perl comment with pod and cut
- Perl indented 1
- Perl indented 2
- Python
- Python indented 1
- Python indented 2
- Ruby
- Ruby indented 1
- Ruby indented 2
- Markdown
- Param
- Permission
- indent
- Category_official
- City
- 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
Example of @apiDefine and @apiUse
GET /define
Name | Type | Description |
---|---|---|
field3 | This is Field 3 (local). |
|
field1 | This is Field 1. |
|
field2 | This is Field 2. |
This is a simple deprecated hint.
GET /deprecated/foo/:id
Name | Type | Description |
---|---|---|
param1 | Parameter and description. |
This is a deprecated hint with a link to the new method.
GET /deprecated/bar/:id
Name | Type | Description |
---|---|---|
param1 | Parameter and description. |
Escape Example data.
GET /test/escape
Example usage:
curl -i http://localhost/escape/text
<b>curl -i http://localhost/escape/html</b>
<xml>curl -i http://localhost/escape/xml</xml>
HTTP/1.1 200 OK {
field_text: 'text-value',
field_html: '<b>html-value</b>',
field_xml: '<xml>xml-value</xml>'
}
Extended usage of @apiExample with different example types.
GET /example/
PHP Example (new)
echo 'This is the content. (new)';
JS Example
console.log('This is the content.');
echo 'This is the success content. (new)';
console.log('This is the success content.');
echo 'This is the error content.';
console.log('This is the error content.');
GET /group/:id
Title and Grouping of param, success and error
GET /test/:id
Name | Type | Description |
---|---|---|
param1 | String |
No Group, automatically set Group to "Parameter" |
Name | Type | Description |
---|---|---|
param2 | String |
Group "login" |
param3 | String |
Group "login" with default Value Default value: Default Value |
Name | Type | Description |
---|---|---|
success2 | String |
Group "201" |
success3 | String |
Group "201" with default Value Default value: Default Value |
Name | Type | Description |
---|---|---|
success1 | String |
No Group, automatically set "Success 200" |
Name | Type | Description |
---|---|---|
error2 | String |
Undefined Group "400" |
Name | Type | Description |
---|---|---|
error3 | String |
Group "401" |
Name | Type | Description |
---|---|---|
error1 | String |
No Group automatically set "Error 4xx" |
Usage of @headerExample.
GET /header/example/
An example:
curl -i http://localhost/header/example/
Test for @apiHeader (same as @apiParam)
GET /header/:id
Name | Type | Description |
---|---|---|
header1 | String |
Parameter with type and description. |
header2 | String |
|
header3 | String |
Parameter with type, description and default value. |
header4 | String |
|
header5 | Basic Parameter with description. |
|
header6 | ||
header7 | Basic Parameter with description and default value. |
|
header8 | ||
header9 | optional Optional basic Parameter with description. |
|
header10 | optional | |
header11 | optional Optional basic Parameter with description and default value. |
|
header12 | optional | |
header13 | String |
optional Optional Parameter with type and description. |
header14 | String |
optional |
header15 | String |
optional Optional Parameter with type, description and default value. |
header16 | String |
optional |
Name | Type | Description |
---|---|---|
reqHeader1 | Basic Parameter with description. |
|
reqHeader2 | Basic Parameter with description. |
Test for Clojure Comment-Syntax.
GET /language/clojure
GET /language/clojure/indented1
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
Test for CoffeeScript Comment-Syntax.
GET /language/coffeescript
GET /language/coffeescript/indented1
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
GET /language/coffeescript/indented2
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
Test for Erlang Comment-Syntax.
GET /language/erlang
GET /language/erlang/indented1
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
GET /language/erlang/indented2
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
Test for JavaScript Comment-Syntax.
GET /language/javascript
GET /language/javascript/indented1
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
GET /language/javascript/indented2
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
Test for Perl Comment-Syntax.
GET /language/perl
GET /language/perl/podcut
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
GET /language/perl/indented1
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
GET /language/perl/indented2
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
Test for Python Comment-Syntax.
GET /language/python
GET /language/python/indented1
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
GET /language/python/indented2
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
Test for Ruby Comment-Syntax.
GET /language/ruby
GET /language/ruby/indented1
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
GET /language/ruby/indented2
Test for indented comment.
This is example line 2.
This is example line 3.
Line 4 indented (with tab at beginning).
Line 5 indented.
This is example line 6.
Enable markdown for all description fields.
This text is in a separate p.
- List 1
- List 2
Multiline markdown text, output in one line.
GET /markdown/:id
Name | Type | Description |
---|---|---|
param1 | String |
This is a markdown apiParam Separate line. |
Returned error parameters. Syntax is the same as for @apiParam
GET /param/:id
Name | Type | Description |
---|---|---|
error1Error | This is Error 1. |
|
error2Error | This is Error 2. |
Usage of @apiParamExample.
GET /param/example/
Name | Type | Description |
---|---|---|
name | String |
Fullname. |
A common example:
curl -i http://localhost/param/example/
json
- A JSON example:
{
"name": "John Doe"
}
Parameters and different Versions: 0.1.1
GET /param/:id
Name | Type | Description |
---|---|---|
param1 | Parameter and description. |
|
param2 | ||
param3 | Parameter, default value and description. Default value: Default Value |
|
param4 | Default value: Default Value |
|
param5 | optional Optional parameter and description. |
|
param6 | optional | |
param7 | optional Optional parameter, default value and description. Default value: Default Value |
|
param8 | optional Default value: Default Value |
|
param9 | String |
Type, parameter and description. |
param10 | String |
|
param11 | String |
Type, parameter and default value. Default value: Default Value |
param12 | String |
Default value: Default Value |
param13 | String |
optional Type, optional parameter and description. |
param14 | String |
optional |
param15 | String |
optional Type, optional parameter, default value and description. Default value: Default Value |
param26 | String |
optional Default value: Default Value |
param17 | String |
Type, size, parameter and description. Size range: 4,8 |
param18 | Number |
Type, size, parameter and description. Size range: 1-3 |
param19 | String |
Type, size, parameter, default value and description. Default value: Default ValueSize range: 4,8 |
param20 | Number |
Type, size, parameter, default value and description. Default value: 1Size range: 1-3 |
param21 | String |
Type, parameter and allowed string value. Allowed values: "value 1" |
param22 | String |
Type, parameter and allowed list of string values. Allowed values: "value 1","value 2" |
param23 | Number |
Type, parameter and allowed value. Allowed values: 4711 |
param24 | Number |
Type, parameter and allowed list of values. Allowed values: 4711,4712 |
param25 | String |
Type, size, parameter and allowed string value. Size range: 1,10Allowed values: "value 1" |
param27 | Number |
Type, size, parameter and allowed value. Size range: 1-9999Allowed values: 4711 |
param28 | Number |
Type, size, parameter and allowed list of values. Size range: 1-9999Allowed values: 4711,4712 |
Returned success parameters. Syntax is the same as for @apiParam
GET /param/:id
Name | Type | Description |
---|---|---|
success1 | This is Success 1. |
|
success2 | This is Success 2. |
@apiPermission test.
GET /permission/
text.
GET /indent/word
Text line 1 (Begin: 4xSpaces (3 removed)). Text line 2 (Begin: 3xSpaces (3 removed), End: 2xSpaces).
GET /indent/trim/multi/spaces
Text line 1 (Begin: 1xTab, 2xSpaces). Text line 2 (Begin: 3xSpaces, End: 1xTab).
GET /indent/trim/multi/tabs/and/space
Text line 1 (Begin: 3xTab (2 removed)). Text line 2 (Begin: 2x Tab (2 removed), End: 1xTab).
GET /indent/trim/multi/tabs
Text line 1 (Begin: 3xSpaces (3 removed), End: 1xSpace).
GET /indent/trim/single
Delete a category. Sample request has been disabled here.
DELETE /category
Name | Type | Description |
---|---|---|
id | Number |
Category ID. |
json
- Some json code:
{
"user": "Sample User",
"payload": {
"test": [
"code": "
public class HelloWorldTest {
HelloWorld hw = new HelloWorld();
@Test
public void testOkay {
assertEquals(\"HelloWorld\", hw.getMsg());
}
}"
]
}
}
Get a category. Sample request on example.com here.
GET /category
Name | Type | Description |
---|---|---|
id | Number |
optional Category ID. Default value: 123 |
id2 | Number |
Category ID2. |
Create a new city.
POST /city
Name | Type | Description |
---|---|---|
view | String |
Type of view. Default value: AerialAllowed values: Aerial,Land,Underwater |
zoom | Number |
Zoom. |
Name | Type | Description |
---|---|---|
name | String |
Name of the city Default value: Paris |
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/4711
Javascript 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/yep
Javascript 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.