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:

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

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.

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