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.

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

will be rendered as:

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:

1

Define named examples

The highlighted lines show how to set the example name.

1paths:
2 /pet:
3 put:
4 summary: Update an existing pet
5 operationId: pets_update
6 requestBody:
7 content:
8 application/json:
9 schema:
10 $ref: '#/components/schemas/Pet'
11 examples:
12 ExampleWithMarkley:
13 summary: This is an example of a Pet
14 value:
15 name: Markley
16 id: 44
1service:
2 auth: true
3 base-path: ""
4 endpoints:
5 update:
6 docs: Update an existing pet
7 method: PUT
8 path: /pet
9 request: Pet
10 examples:
11 - name: ExampleWithMarkley
12 docs: This is an example of a Pet
13 request:
14 name: Markley
15 id: 44
2

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 />
Built with