Swagger Petstore
This is a sample server Petstore server.
You can find out more about Swagger at
http://swagger.io or on irc.freenode.net, #swagger.
For this sample, you can use the api key special-key
to test the authorization filters.
Introduction
This API is documented in OpenAPI format and is based on
Petstore sample provided by swagger.io team.
It was extended to illustrate features of generator-openapi-repo
tool and ReDoc documentation. In addition to standard
OpenAPI syntax we use a few vendor extensions.
OpenAPI Specification
This API is documented in OpenAPI format and is based on
Petstore sample provided by swagger.io team.
It was extended to illustrate features of generator-openapi-repo
tool and ReDoc documentation. In addition to standard
OpenAPI syntax we use a few vendor extensions.
Cross-Origin Resource Sharing
This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with W3C spec.
And that allows cross-domain communication from the browser.
All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
Authentication
Petstore offers two forms of authentication:
- API Key
- OAuth2
OAuth2 - an open protocol to allow secure authorization in a simple
and standard method from web, mobile and desktop applications.
Contact
Terms of Service
http://swagger.io/terms/License
Apache 2.0External Documentation
Find out how to create Github repo for your OpenAPI spec.Servers
pet
Everything about your Pets
OperationId with backslash
Samples
get {
url: //petstore.swagger.io/v2/pet
}
headers {
Content-Type: application/json
}
get {
url: //petstore.swagger.io/v2/pet
}
headers {
Content-Type: application/json
}
curl -X GET \
'//petstore.swagger.io/v2/pet' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/pet', {headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/pet';
$method = 'GET';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/pet'
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.json())
Add a new pet to the store
Add new pet to the store inventory.
Authorizations
Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.
- write:pets: modify pets in your account
- read:pets: read your pets
Request Body
Responses
Samples
post {
url: //petstore.swagger.io/v2/pet
}
headers {
Content-Type: application/json
}
post {
url: //petstore.swagger.io/v2/pet
}
headers {
Content-Type: application/json
}
curl -X POST \
'//petstore.swagger.io/v2/pet' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/pet', {method:'POST',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/pet';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/pet'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Update an existing pet
Authorizations
Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.
- write:pets: modify pets in your account
- read:pets: read your pets
Request Body
Responses
Samples
put {
url: //petstore.swagger.io/v2/pet
}
headers {
Content-Type: application/json
}
put {
url: //petstore.swagger.io/v2/pet
}
headers {
Content-Type: application/json
}
curl -X PUT \
'//petstore.swagger.io/v2/pet' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/pet', {method:'PUT',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/pet';
$method = 'PUT';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/pet'
headers = {
'Content-Type': 'application/json'
}
response = requests.put(url, headers=headers)
print(response.json())
OperationId with quotes
Samples
delete {
url: //petstore.swagger.io/v2/pet
}
headers {
Content-Type: application/json
}
delete {
url: //petstore.swagger.io/v2/pet
}
headers {
Content-Type: application/json
}
curl -X DELETE \
'//petstore.swagger.io/v2/pet' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/pet', {method:'DELETE',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/pet';
$method = 'DELETE';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/pet'
headers = {
'Content-Type': 'application/json'
}
response = requests.delete(url, headers=headers)
print(response.json())
Find pet by ID
Returns a single pet
Authorizations
For this sample, you can use the api key special-key
to test the authorization filters.
Parameters
Path Parameters
ID of pet to return
int64
Responses
Samples
get {
url: //petstore.swagger.io/v2/pet/{petId}
}
headers {
Content-Type: application/json
}
get {
url: //petstore.swagger.io/v2/pet/{petId}
}
headers {
Content-Type: application/json
}
curl -X GET \
'//petstore.swagger.io/v2/pet/{petId}' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/pet/{petId}', {headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/pet/{petId}';
$method = 'GET';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/pet/{petId}'
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.json())
Updates a pet in the store with form data
Authorizations
Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.
- write:pets: modify pets in your account
- read:pets: read your pets
Parameters
Path Parameters
ID of pet that needs to be updated
int64
Request Body
Responses
Samples
post {
url: //petstore.swagger.io/v2/pet/{petId}
}
headers {
Content-Type: application/json
}
post {
url: //petstore.swagger.io/v2/pet/{petId}
}
headers {
Content-Type: application/json
}
curl -X POST \
'//petstore.swagger.io/v2/pet/{petId}' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/pet/{petId}', {method:'POST',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/pet/{petId}';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/pet/{petId}'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Deletes a pet
Authorizations
Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.
- write:pets: modify pets in your account
- read:pets: read your pets
Parameters
Header Parameters
Bearer <TOKEN>
Path Parameters
Pet id to delete
int64
Responses
Samples
delete {
url: //petstore.swagger.io/v2/pet/{petId}
}
headers {
Content-Type: application/json
api_key: Bearer
}
delete {
url: //petstore.swagger.io/v2/pet/{petId}
}
headers {
Content-Type: application/json
api_key: Bearer
}
curl -X DELETE \
'//petstore.swagger.io/v2/pet/{petId}' \
-H "Content-Type: application/json" \
-H "api_key: Bearer <TOKEN>"
fetch('//petstore.swagger.io/v2/pet/{petId}', {method:'DELETE',headers:{'Content-Type':'application/json','api_key':'Bearer <TOKEN>'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/pet/{petId}';
$method = 'DELETE';
$headers = [
'Content-Type' => 'application/json',
'api_key' => 'Bearer <TOKEN>',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/pet/{petId}'
headers = {
'Content-Type': 'application/json',
'api_key': 'Bearer <TOKEN>'
}
response = requests.delete(url, headers=headers)
print(response.json())
uploads an image
Authorizations
Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.
- write:pets: modify pets in your account
- read:pets: read your pets
Parameters
Path Parameters
ID of pet to update
int64
Request Body
Responses
Samples
post {
url: //petstore.swagger.io/v2/pet/{petId}/uploadImage
}
headers {
Content-Type: application/json
}
post {
url: //petstore.swagger.io/v2/pet/{petId}/uploadImage
}
headers {
Content-Type: application/json
}
curl -X POST \
'//petstore.swagger.io/v2/pet/{petId}/uploadImage' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/pet/{petId}/uploadImage', {method:'POST',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/pet/{petId}/uploadImage';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/pet/{petId}/uploadImage'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Finds Pets by status
Multiple status values can be provided with comma separated strings
Authorizations
Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.
- write:pets: modify pets in your account
- read:pets: read your pets
Parameters
Query Parameters
Status values that need to be considered for filter
1
3
Responses
Samples
get {
url: //petstore.swagger.io/v2/pet/findByStatus
}
headers {
Content-Type: application/json
}
get {
url: //petstore.swagger.io/v2/pet/findByStatus
}
headers {
Content-Type: application/json
}
curl -X GET \
'//petstore.swagger.io/v2/pet/findByStatus' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/pet/findByStatus', {headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/pet/findByStatus';
$method = 'GET';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/pet/findByStatus'
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.json())
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Authorizations
Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.
- write:pets: modify pets in your account
- read:pets: read your pets
Parameters
Query Parameters
Tags to filter by
Responses
Samples
get {
url: //petstore.swagger.io/v2/pet/findByTags
}
headers {
Content-Type: application/json
}
get {
url: //petstore.swagger.io/v2/pet/findByTags
}
headers {
Content-Type: application/json
}
curl -X GET \
'//petstore.swagger.io/v2/pet/findByTags' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/pet/findByTags', {headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/pet/findByTags';
$method = 'GET';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/pet/findByTags'
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.json())
store
Access to Petstore orders
Returns pet inventories by status
Returns a map of status codes to quantities
Authorizations
For this sample, you can use the api key special-key
to test the authorization filters.
Responses
Samples
get {
url: //petstore.swagger.io/v2/store/inventory
}
headers {
Content-Type: application/json
}
get {
url: //petstore.swagger.io/v2/store/inventory
}
headers {
Content-Type: application/json
}
curl -X GET \
'//petstore.swagger.io/v2/store/inventory' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/store/inventory', {headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/store/inventory';
$method = 'GET';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/store/inventory'
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.json())
Place an order for a pet
Request Body
Responses
Samples
post {
url: //petstore.swagger.io/v2/store/order
}
headers {
Content-Type: application/json
}
post {
url: //petstore.swagger.io/v2/store/order
}
headers {
Content-Type: application/json
}
curl -X POST \
'//petstore.swagger.io/v2/store/order' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/store/order', {method:'POST',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/store/order';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/store/order'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
Parameters
Path Parameters
ID of pet that needs to be fetched
int64
1
5
Responses
Samples
get {
url: //petstore.swagger.io/v2/store/order/{orderId}
}
headers {
Content-Type: application/json
}
get {
url: //petstore.swagger.io/v2/store/order/{orderId}
}
headers {
Content-Type: application/json
}
curl -X GET \
'//petstore.swagger.io/v2/store/order/{orderId}' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/store/order/{orderId}', {headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/store/order/{orderId}';
$method = 'GET';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/store/order/{orderId}'
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.json())
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
Parameters
Path Parameters
ID of the order that needs to be deleted
1
Responses
Samples
delete {
url: //petstore.swagger.io/v2/store/order/{orderId}
}
headers {
Content-Type: application/json
}
delete {
url: //petstore.swagger.io/v2/store/order/{orderId}
}
headers {
Content-Type: application/json
}
curl -X DELETE \
'//petstore.swagger.io/v2/store/order/{orderId}' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/store/order/{orderId}', {method:'DELETE',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/store/order/{orderId}';
$method = 'DELETE';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/store/order/{orderId}'
headers = {
'Content-Type': 'application/json'
}
response = requests.delete(url, headers=headers)
print(response.json())
Subscribe to the Store events
Add subscription for a store events
Request Body
Responses
Samples
post {
url: //petstore.swagger.io/v2/store/subscribe
}
headers {
Content-Type: application/json
}
post {
url: //petstore.swagger.io/v2/store/subscribe
}
headers {
Content-Type: application/json
}
curl -X POST \
'//petstore.swagger.io/v2/store/subscribe' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/store/subscribe', {method:'POST',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/store/subscribe';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/store/subscribe'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
user
Operations about user
Create user
This can only be done by the logged in user.
Request Body
Responses
Samples
post {
url: //petstore.swagger.io/v2/user
}
headers {
Content-Type: application/json
}
post {
url: //petstore.swagger.io/v2/user
}
headers {
Content-Type: application/json
}
curl -X POST \
'//petstore.swagger.io/v2/user' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/user', {method:'POST',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/user';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/user'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Get user by user name
Parameters
Path Parameters
The name that needs to be fetched. Use user1 for testing.
Responses
Samples
get {
url: //petstore.swagger.io/v2/user/{username}
}
headers {
Content-Type: application/json
}
get {
url: //petstore.swagger.io/v2/user/{username}
}
headers {
Content-Type: application/json
}
curl -X GET \
'//petstore.swagger.io/v2/user/{username}' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/user/{username}', {headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/user/{username}';
$method = 'GET';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/user/{username}'
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.json())
Updated user
This can only be done by the logged in user.
Parameters
Path Parameters
name that need to be updated
Request Body
Responses
Samples
put {
url: //petstore.swagger.io/v2/user/{username}
}
headers {
Content-Type: application/json
}
put {
url: //petstore.swagger.io/v2/user/{username}
}
headers {
Content-Type: application/json
}
curl -X PUT \
'//petstore.swagger.io/v2/user/{username}' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/user/{username}', {method:'PUT',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/user/{username}';
$method = 'PUT';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/user/{username}'
headers = {
'Content-Type': 'application/json'
}
response = requests.put(url, headers=headers)
print(response.json())
Delete user
This can only be done by the logged in user.
Parameters
Path Parameters
The name that needs to be deleted
Responses
Samples
delete {
url: //petstore.swagger.io/v2/user/{username}
}
headers {
Content-Type: application/json
}
delete {
url: //petstore.swagger.io/v2/user/{username}
}
headers {
Content-Type: application/json
}
curl -X DELETE \
'//petstore.swagger.io/v2/user/{username}' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/user/{username}', {method:'DELETE',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/user/{username}';
$method = 'DELETE';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/user/{username}'
headers = {
'Content-Type': 'application/json'
}
response = requests.delete(url, headers=headers)
print(response.json())
Creates list of users with given input array
Request Body
Responses
Samples
post {
url: //petstore.swagger.io/v2/user/createWithArray
}
headers {
Content-Type: application/json
}
post {
url: //petstore.swagger.io/v2/user/createWithArray
}
headers {
Content-Type: application/json
}
curl -X POST \
'//petstore.swagger.io/v2/user/createWithArray' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/user/createWithArray', {method:'POST',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/user/createWithArray';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/user/createWithArray'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Creates list of users with given input array
Request Body
Responses
Samples
post {
url: //petstore.swagger.io/v2/user/createWithList
}
headers {
Content-Type: application/json
}
post {
url: //petstore.swagger.io/v2/user/createWithList
}
headers {
Content-Type: application/json
}
curl -X POST \
'//petstore.swagger.io/v2/user/createWithList' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/user/createWithList', {method:'POST',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/user/createWithList';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/user/createWithList'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Logs user into the system
Parameters
Query Parameters
The user name for login
The password for login in clear text
Responses
Samples
get {
url: //petstore.swagger.io/v2/user/login
}
headers {
Content-Type: application/json
}
get {
url: //petstore.swagger.io/v2/user/login
}
headers {
Content-Type: application/json
}
curl -X GET \
'//petstore.swagger.io/v2/user/login' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/user/login', {headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/user/login';
$method = 'GET';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/user/login'
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.json())
Logs out current logged in user session
Responses
Samples
get {
url: //petstore.swagger.io/v2/user/logout
}
headers {
Content-Type: application/json
}
get {
url: //petstore.swagger.io/v2/user/logout
}
headers {
Content-Type: application/json
}
curl -X GET \
'//petstore.swagger.io/v2/user/logout' \
-H "Content-Type: application/json"
fetch('//petstore.swagger.io/v2/user/logout', {headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = '//petstore.swagger.io/v2/user/logout';
$method = 'GET';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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 = '//petstore.swagger.io/v2/user/logout'
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.json())