Skip to content
v1.0.0

Swagger Petstore

A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification

Contact

Servers

https://petstore.swagger.io/v2

GET /pets

GET
/pets

Returns all pets from the system that the user has access to
Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.

Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.

Parameters

Query Parameters

tags

tags to filter by

Typearray
limit

maximum number of results to return

Typeinteger

Responses

pet response
JSON
[
{
"name": "string",
"tag": "string",
"id": 0
}
]

Samples

cURL
curl -X GET https://petstore.swagger.io/v2/pets
JavaScript
fetch("https://petstore.swagger.io/v2/pets")
  .then(response => response.json())
  .then(data => console.log(data));
PHP
file_get_contents("https://petstore.swagger.io/v2/pets");
Python
import requests
response = requests.get("https://petstore.swagger.io/v2/pets")
print(response.json())

POST /pets

POST
/pets

Creates a new pet in the store. Duplicates are allowed

Request Body

JSON
{
"name": "string",
"tag": "string"
}

Responses

pet response
JSON
{
"name": "string",
"tag": "string",
"id": 0
}

Samples

cURL
curl -X POST https://petstore.swagger.io/v2/pets
JavaScript
fetch("https://petstore.swagger.io/v2/pets", { method: "POST" })
  .then(response => response.json())
  .then(data => console.log(data));
PHP
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://petstore.swagger.io/v2/pets");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Python
import requests
response = requests.post("https://petstore.swagger.io/v2/pets")
print(response.json())

GET /pets/{id}

GET
/pets/{id}

Returns a user based on a single ID, if the user does not have access to the pet

Parameters

Path Parameters

id*

ID of pet to fetch

Typeinteger
Required

Responses

pet response
JSON
{
"name": "string",
"tag": "string",
"id": 0
}

Samples

cURL
curl -X GET https://petstore.swagger.io/v2/pets/{id}
JavaScript
fetch("https://petstore.swagger.io/v2/pets/{id}")
  .then(response => response.json())
  .then(data => console.log(data));
PHP
file_get_contents("https://petstore.swagger.io/v2/pets/{id}");
Python
import requests
response = requests.get("https://petstore.swagger.io/v2/pets/{id}")
print(response.json())

DELETE /pets/{id}

DELETE
/pets/{id}

deletes a single pet based on the ID supplied

Parameters

Path Parameters

id*

ID of pet to delete

Typeinteger
Required

Responses

pet deleted

Samples

cURL
curl -X DELETE https://petstore.swagger.io/v2/pets/{id}
JavaScript
fetch("https://petstore.swagger.io/v2/pets/{id}", { method: "DELETE" })
  .then(response => response.json())
  .then(data => console.log(data));
PHP
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://petstore.swagger.io/v2/pets/{id}");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Python
import requests
response = requests.delete("https://petstore.swagger.io/v2/pets/{id}")
print(response.json())

Powered by VitePress OpenAPI