Skip to content
v1.0.0

Parameter Testing API

Example of an OpenAPI document with different types of parameters.

Servers

https://api.example.com

Default


ID: get-users-{userId}

Get user information by ID

GET
/users/{userId}

Returns information for a specific user.

Parameters

Header Parameters

X-Custom-Header

A custom header for testing purposes

Typestring
Examplecustom-value

Path Parameters

userId*

The ID of the user

Typestring
Required
Example123

Query Parameters

age

The age of the user to filter

Typeinteger
Example25
acceptsCookies*

Whether the user accepts cookies

Typeboolean
Required
Exampletrue
isSubscribed

Whether the user is subscribed to the newsletter

Typeboolean
Examplefalse

Responses

Successful response
application/json
JSON
{
"userId": "string",
"name": "string",
"age": 0
}

Samples

Bruno
get {
  url: https://api.example.com/users/123?age=25&acceptsCookies=true&isSubscribed=false
}

headers {
  Content-Type: application/json
  x-custom-header: custom-value
}
Bruno
get {
  url: https://api.example.com/users/123?age=25&acceptsCookies=true&isSubscribed=false
}

headers {
  Content-Type: application/json
  x-custom-header: custom-value
}
cURL
curl -X GET \
'https://api.example.com/users/123?age=25&acceptsCookies=true&isSubscribed=false' \
 -H "Content-Type: application/json" \
 -H "x-custom-header: custom-value"
JavaScript
fetch('https://api.example.com/users/123?age=25&acceptsCookies=true&isSubscribed=false', {headers:{'Content-Type':'application/json','x-custom-header':'custom-value'}})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://api.example.com/users/123';
$method = 'GET';
$headers = [
    'Content-Type' => 'application/json',
    'x-custom-header' => 'custom-value',
];
$query = http_build_query([
    'age' => '25',
    'acceptsCookies' => 'true',
    'isSubscribed' => 'false',
]);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url . '?' . $query);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://api.example.com/users/123'
params = {
    'age': 25,
    'acceptsCookies': true,
    'isSubscribed': false
}
headers = {
    'Content-Type': 'application/json',
    'x-custom-header': 'custom-value'
}

response = requests.get(url, params=params, headers=headers)
print(response.json())

Powered by VitePress OpenAPI