Endpoint request snippet
<EndpointRequestSnippet> embeds an endpoint's request example from the API reference.
This component pulls data from the API reference, so it updates automatically with the OpenAPI spec. The examples below reference this site's platform API.
A request example card for an endpoint, with multi-language code and a "Try it" button (alias <RequestSnippet>):
<EndpointRequestSnippet endpoint="POST /orgs/{org}/api-keys" languages={["curl", "python", "javascript"]} />POST/orgs/:org/api-keys
curl -X POST https://api.butterix.com/v1/orgs/acme/api-keys \
-H "Content-Type: application/json" \
-d '{}'import requests
url = "https://api.butterix.com/v1/orgs/acme/api-keys"
payload = {}
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())const response = await fetch("https://api.butterix.com/v1/orgs/acme/api-keys", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({})
});
const data = await response.json();
console.log(data);METHOD /path, e.g. "POST /orgs/{org}/api-keys"; with multiple APIs, write api-name::METHOD /path.Languages to show, in order; may include
"payload" (request body only). Aliases such as typescript, ts, and shell work too.In the page's .md version it's the request example as code blocks: one per language when languages is set, otherwise only the site's first language.