v1.0.0
Parameter Testing API
Example of an OpenAPI document with different types of parameters.
Servers
https://api.example.com
Default
Operations
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
Example
custom-value
Path Parameters
userId*
The ID of the user
Typestring
RequiredExample
123
Query Parameters
age
The age of the user to filter
Typeinteger
Example
25
acceptsCookies*
Whether the user accepts cookies
Typeboolean
RequiredExample
true
isSubscribed
Whether the user is subscribed to the newsletter
Typeboolean
Example
false
Responses
Successful responseSchema JSON JSON
application/json
{
"userId": "string",
"name": "string",
"age": 0
}
GET
/users/{userId}
Samples
get {
url: https://api.example.com/users/123?age=25&acceptsCookies=true&isSubscribed=false
}
headers {
Content-Type: application/json
x-custom-header: custom-value
}
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 -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"
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
$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;
?>
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())