Find pet by ID
1 min
GET
//petstore.swagger.io/v2/pet/{petId}
Path Parameters
- petIdinteger<int64>requiredDescription
Responses
200
- Pet
- idIdDescription
- categoryCategoryDescription
- idIdDescription
- namestringDescription
- subobjectDescription
- prop1stringDescription
- namestringrequiredExampleDescriptionDefaultFluffyIsDefault
- photoUrlsstring,integer,nullrequiredDescription
- friendPet
- Circular-Reference
- tagsTag[]Description
- idIdDescription
- namestringDescription
- statusstring<available | pending | sold>DescriptionDefaultpending
- petTypestringExampleDescription
- huntingSkillinteger
400
404
405
- Tag
- idIdDescription
- namestringDescription
curl
curl --request GET \
--url //petstore.swagger.io/v2/pet/{petId} \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("//petstore.swagger.io/v2/pet/{petId}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("//petstore.swagger.io/v2/pet/{petId}")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "//petstore.swagger.io/v2/pet/{petId}"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
200
// successful operation
{
"id": 0,
"category": {
"id": 0,
"name": "",
"sub": {
"prop1": ""
}
},
"name": "GuruIsExample",
"photoUrls": "",
"friend": {
"": ""
},
"tags": [
{
"id": 0,
"name": ""
}
],
"status": "",
"petType": "k9",
"huntingSkill": 0
}GENERATED
// successful operation
{
"id": 0,
"category": {
"id": 0,
"name": "",
"sub": {
"prop1": ""
}
},
"name": "GuruIsExample",
"photoUrls": "",
"friend": {
"": ""
},
"tags": [
{
"id": 0,
"name": ""
}
],
"status": "",
"petType": "k9",
"huntingSkill": 0
}Super Awesome Spren Userww
{"user": "SuperAwesomeSprenUsewww00200r", "readingData": "spren_finger_camera_sdk_reading_data"}400
// Invalid ID supplied
404
// Pet not found
405
// Invalid input
{
"id": 0,
"name": ""
}GENERATED
// Invalid input
{
"id": 0,
"name": ""
}user
// User example in XML
// https://foo.bar/examples/user-example.xmluse2r
// User example in XML
{
"name": "Fluffy",
"petType": "Cat",
"color": "White",
"gender": "male",
"breed": "Persian"
}Super Awesome Spren User
{"user": "SuperAwesomeSprenUser", "readingData": "spren_finger_camera_sdk_reading_data"}Returns a single pet