Endpoint Request Snippet

The EndpointRequestSnippet component is used to reference an endpoint request from your API Reference. Below is an example of referencing the request for the POST /snippets endpoint.

1<EndpointRequestSnippet endpoint="POST /snippets" />

will be rendered as:

1curl -X POST \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "endpoint": {
6 "path": "/v1/search",
7 "method": "GET"
8 }

Reference particular examples

If you want to reference a particular example in the request snippet, you can set example prop to the name of the example. See the steps below:

Define named examples

The highlighed lines show how to set the example name.

Reference the example

In the API Definition, the example had a name ExampleWithMarkley. You can reference the example directly:

1 <EndpointRequestSnippet
2 endpoint="PUT /pet"
3 example="ExampleWithMarkley"
4 />