-
Notifications
You must be signed in to change notification settings - Fork 1.1k
API endpoint
Gus edited this page Feb 2, 2018
·
13 revisions
Here are the following steps to document a new API endpoint:
- Create a new folder in
content/api
with your API name - Create a
code_snippets
folder inside the previously created api sub-folder to store all your code examples - Create a
_index.md
file at the root of yourAPI_NAME
folder that contains just the following parameter:
---
title: TITLE OF YOUR API
external_redirect: /api/
---
- Create an
<MY_API_ENDPOINT>.md
file that describes your API:
---
title: TITLE OF YOUR API ENDPOINT
type: apicontent
order: XX
---
## TITLE OF YOUR API
This is my api description
Note: The order
parameter defines where your API entry is displayed in the main API navigation bar
- Create your
ENDPOINT.md
file that describes your endpoint:
---
title: MY API ENDPOINT
type: apicontent
order: XX.1
---
## ENDPOINT TITLE
This is my endpoint description
##### ARGUMENTS
* `arg_1` [*required*]:
My arg_1 description
* `arg_2` [*optional*, *default*=**None**]:
My arg_2 description
Note: Increment your order parameter to control the position of your endpoint in your API sub-navigation menu.
- Create your code blocks file in the
code_snippets
folder. There are two types of files:
- Request code blocks:
api-ENDPOINT.py
,api-ENDPOINT.rb
, andapi-ENDPOINT.sh
- Result code blocks:
result.api-ENDPOINT.py
,result.api-ENDPOINT.rb
, andresult.api-ENDPOINT.sh
You need to have a code blocs for all languages currently supported, aka : Python, Ruby, and Curl
- Call your ENDPOINT code blocs: create a
ENDPOINT_code.md
file in your api sub-folder with the following content:
---
title: MY API ENDPOINT
type: apicode
order: XX.1
---
##### Signature
`GET api/v1/my/api/endpoint`
##### Example Request
{{< code-snippets basename="api-ENDPOINT" >}}
##### Example Response
{{< code-snippets basename="result.api-ENDPOINT" >}}
Note: the order parameter must have the same value as the one in your ENDPOINT.md
file