index.md 12 KB


title: API Reference

language_tabs:

  • bash
  • javascript

includes:

search: true

toc_footers:

Welcome to the generated API reference. Get Postman Collection

#Group A

Example title.

This will be the long description. It can also be multiple lines long.

Example request:

curl -X GET \
    -G "http://localhost/api/withDescription" \
    -H "Authorization: customAuthToken" \
    -H "Custom-Header: NotSoCustom" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://localhost/api/withDescription"
);

let headers = {
    "Authorization": "customAuthToken",
    "Custom-Header": "NotSoCustom",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

GET api/withDescription

api/withResponseTag

Example request:

curl -X GET \
    -G "http://localhost/api/withResponseTag" \
    -H "Authorization: customAuthToken" \
    -H "Custom-Header: NotSoCustom" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://localhost/api/withResponseTag"
);

let headers = {
    "Authorization": "customAuthToken",
    "Custom-Header": "NotSoCustom",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "id": 4,
    "name": "banana",
    "color": "red",
    "weight": "1 kg",
    "delicious": true,
    "responseTag": true
}

HTTP Request

GET api/withResponseTag

Endpoint with body parameters.

Example request:

curl -X GET \
    -G "http://localhost/api/withBodyParameters" \
    -H "Authorization: customAuthToken" \
    -H "Custom-Header: NotSoCustom" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"user_id":9,"room_id":"consequatur","forever":false,"another_one":11613.31890586,"yet_another_param":{"name":"consequatur"},"even_more_param":[11613.31890586],"book":{"name":"consequatur","author_id":17,"pages_count":17},"ids":[17],"users":[{"first_name":"John","last_name":"Doe"}]}'

const url = new URL(
    "http://localhost/api/withBodyParameters"
);

let headers = {
    "Authorization": "customAuthToken",
    "Custom-Header": "NotSoCustom",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "user_id": 9,
    "room_id": "consequatur",
    "forever": false,
    "another_one": 11613.31890586,
    "yet_another_param": {
        "name": "consequatur"
    },
    "even_more_param": [
        11613.31890586
    ],
    "book": {
        "name": "consequatur",
        "author_id": 17,
        "pages_count": 17
    },
    "ids": [
        17
    ],
    "users": [
        {
            "first_name": "John",
            "last_name": "Doe"
        }
    ]
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

GET api/withBodyParameters

Body Parameters

Parameter | Type | Status | Description --------- | ------- | ------- | ------- | -----------

`user_id` | integer |  required  | The id of the user.
    `room_id` | string |  optional  | The id of the room.
    `forever` | boolean |  optional  | Whether to ban the user forever.
    `another_one` | number |  optional  | Just need something here.
    `yet_another_param` | object |  required  | Some object params.
    `yet_another_param.name` | string |  required  | Subkey in the object param.
    `even_more_param` | array |  optional  | Some array params.
    `even_more_param.*` | float |  optional  | Subkey in the array param.
    `book.name` | string |  optional  | 
    `book.author_id` | integer |  optional  | 
    `book[pages_count]` | integer |  optional  | 
    `ids.*` | integer |  optional  | 
    `users.*.first_name` | string |  optional  | The first name of the user.
    `users.*.last_name` | string |  optional  | The last name of the user.

api/withQueryParameters

Example request:

curl -X GET \
    -G "http://localhost/api/withQueryParameters?location_id=consequatur&user_id=me&page=4&filters=consequatur&url_encoded=%2B+%5B%5D%26%3D" \
    -H "Authorization: customAuthToken" \
    -H "Custom-Header: NotSoCustom" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://localhost/api/withQueryParameters"
);

let params = {
    "location_id": "consequatur",
    "user_id": "me",
    "page": "4",
    "filters": "consequatur",
    "url_encoded": "+ []&=",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "customAuthToken",
    "Custom-Header": "NotSoCustom",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

GET api/withQueryParameters

Query Parameters

Parameter | Status | Description --------- | ------- | ------- | -----------

`location_id` |  required  | The id of the location.
`user_id` |  required  | The id of the user.
`page` |  required  | The page number.
`filters` |  optional  | The filters.
`url_encoded` |  optional  | Used for testing that URL parameters will be URL-encoded where needed.

api/withAuthTag


Requires authentication

Example request:

curl -X GET \
    -G "http://localhost/api/withAuthTag" \
    -H "Authorization: customAuthToken" \
    -H "Custom-Header: NotSoCustom" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://localhost/api/withAuthTag"
);

let headers = {
    "Authorization": "customAuthToken",
    "Custom-Header": "NotSoCustom",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

GET api/withAuthTag

api/withEloquentApiResource

Example request:

curl -X GET \
    -G "http://localhost/api/withEloquentApiResource" \
    -H "Authorization: customAuthToken" \
    -H "Custom-Header: NotSoCustom" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://localhost/api/withEloquentApiResource"
);

let headers = {
    "Authorization": "customAuthToken",
    "Custom-Header": "NotSoCustom",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "data": {
        "id": 4,
        "name": "Tested Again",
        "email": "a@b.com"
    }
}

HTTP Request

GET api/withEloquentApiResource

api/withMultipleResponseTagsAndStatusCode

Example request:

curl -X POST \
    "http://localhost/api/withMultipleResponseTagsAndStatusCode" \
    -H "Authorization: customAuthToken" \
    -H "Custom-Header: NotSoCustom" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://localhost/api/withMultipleResponseTagsAndStatusCode"
);

let headers = {
    "Authorization": "customAuthToken",
    "Custom-Header": "NotSoCustom",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "id": 4,
    "name": "banana",
    "color": "red",
    "weight": "1 kg",
    "delicious": true,
    "multipleResponseTagsAndStatusCodes": true
}

Example response (401):

{
    "message": "Unauthorized"
}

HTTP Request

POST api/withMultipleResponseTagsAndStatusCode

#Other😎

api/withEloquentApiResourceCollectionClass

Example request:

curl -X GET \
    -G "http://localhost/api/withEloquentApiResourceCollectionClass" \
    -H "Authorization: customAuthToken" \
    -H "Custom-Header: NotSoCustom" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://localhost/api/withEloquentApiResourceCollectionClass"
);

let headers = {
    "Authorization": "customAuthToken",
    "Custom-Header": "NotSoCustom",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "data": [
        {
            "id": 4,
            "name": "Tested Again",
            "email": "a@b.com"
        },
        {
            "id": 4,
            "name": "Tested Again",
            "email": "a@b.com"
        }
    ],
    "links": {
        "self": "link-value"
    }
}

HTTP Request

GET api/withEloquentApiResourceCollectionClass

api/echoesUrlParameters/{param}-{param2}/{param3?}

Example request:

curl -X GET \
    -G "http://localhost/api/echoesUrlParameters/4-consequatur/?something=consequatur" \
    -H "Authorization: customAuthToken" \
    -H "Custom-Header: NotSoCustom" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://localhost/api/echoesUrlParameters/4-consequatur/"
);

let params = {
    "something": "consequatur",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "customAuthToken",
    "Custom-Header": "NotSoCustom",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "param": "4",
    "param2": "consequatur",
    "param3": null,
    "param4": null
}

HTTP Request

GET api/echoesUrlParameters/{param}-{param2}/{param3?}

URL Parameters

Parameter | Status | Description --------- | ------- | ------- | -------

`param` |  required  | 
`param2` |  optional  | 
`param4` |  optional  | 

Query Parameters

Parameter | Status | Description --------- | ------- | ------- | -----------

`something` |  optional  |