Pets API Functions
With these API functions, you can manage the pets in your store's database.
Adding a new petโ
Adds a new pet to the store's database.
Endpoint: https://petstore3.swagger.io/api/v3/pet
Operation: POST
Examplesโ
- API Key
- OAuth 2.0
POST "https://petstore3.swagger.io/api/v3/pet" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "api_key: <YOUR_API_KEY>" \
-d '{
"id": 0,
"name": "string",
"category": {
"id": 0,
"name": "string"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}'
POST "https://petstore3.swagger.io/api/v3/pet" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>" \
-d '{
"id": 0,
"name": "string",
"category": {
"id": 0,
"name": "string"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}'
Responsesโ
| Code | Description |
|---|---|
| 200 | Successful operation |
| 400 | Invalid input |
| 404 | Pet not found |
| 422 | Validation exception |
| default | Unexpected error |
Response exampleโ
200: Successful operation
{
"id": 210,
"name": "Krypto",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
Parametersโ
Request bodyโ
| Name | Type | Description |
|---|---|---|
| body | Pet object | (Required) The Pet object to add to the store. |
Updating an existing petโ
Updates an existing pet by its ID.
Endpoint: https://petstore3.swagger.io/api/v3/pet
Operation: PUT
Examplesโ
- API Key
- OAuth 2.0
PUT "https://petstore3.swagger.io/api/v3/pet" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "api_key: <YOUR_API_KEY>" \
-d '{
"id": 210,
"name": "Krypto",
"status": "available"
}'
PUT "https://petstore3.swagger.io/api/v3/pet" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>" \
-d '{
"id": 210,
"name": "Krypto",
"status": "available"
}'
Responsesโ
| Code | Description |
|---|---|
| 200 | Successful operation |
| 400 | Invalid input |
| 404 | Pet not found |
| 422 | Validation exception |
| default | Unexpected error |
Response exampleโ
200: Successful operation
{
"id": 210,
"name": "Krypto",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
Parametersโ
Request bodyโ
| Name | Type | Description |
|---|---|---|
| body | Pet object | (Required) Pet object to update. |
Finding a pet by statusโ
Finds pets by their status.
Endpoint: https://petstore3.swagger.io/api/v3/pet/findByStatus
Operation: GET
Examplesโ
- API Key
- OAuth 2.0
GET "https://petstore3.swagger.io/api/v3/pet/findByStatus?status=available" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"
GET "https://petstore3.swagger.io/api/v3/pet/findByStatus?status=available" \
-H "accept: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>"
Responsesโ
| Code | Description |
|---|---|
| 200 | Successful operation |
| 400 | Invalid input |
| default | Unexpected error |
Response exampleโ
200: Successful operation
[
{
"id": 210,
"name": "Krypto",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
]
Parametersโ
Query parametersโ
| Name | Type | Description |
|---|---|---|
| status | string | Status of the pet to find. Default: available. Allowed values: available, pending, sold. |
Finding pets by tagsโ
Finds pets by their tags.
Endpoint: https://petstore3.swagger.io/api/v3/pet/findByTags
Operation: GET
Examplesโ
- API Key
- OAuth 2.0
GET "https://petstore3.swagger.io/api/v3/pet/findByTags?tags=string" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"
GET "https://petstore3.swagger.io/api/v3/pet/findByTags?tags=string" \
-H "accept: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>"
Responsesโ
| Code | Description |
|---|---|
| 200 | Successful operation |
| 400 | Invalid input |
| default | Unexpected error |
Response exampleโ
200: Successful operation
[
{
"id": 210,
"name": "Krypto",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
]
Parametersโ
Query parametersโ
| Name | Type | Description |
|---|---|---|
| tags | array | Tags to filter by. Default: []. Allowed values: Any valid tag names. |
Finding a pet by Idโ
Finds a pet by its unique ID.
Endpoint: https://petstore3.swagger.io/api/v3/pet/{petId}
Operation: GET
Examplesโ
- API Key
- OAuth 2.0
GET "https://petstore3.swagger.io/api/v3/pet/210" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"
GET "https://petstore3.swagger.io/api/v3/pet/210" \
-H "accept: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>"
Responsesโ
| Code | Description |
|---|---|
| 200 | Successful operation |
| 400 | Invalid ID supplied |
| 404 | Pet not found |
| default | Unexpected error |
Response exampleโ
200: Successful operation
{
"id": 210,
"name": "Krypto",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
Parametersโ
Path p1arametersโ
| Name | Type | Description |
|---|---|---|
| petId | integer | ID of pet to return |
Updating a pet with form dataโ
Updates a pet in the store with form data.
Endpoint: https://petstore3.swagger.io/api/v3/pet/{petId}
Operation: POST
Examplesโ
- API Key
- OAuth 2.0
POST "https://petstore3.swagger.io/api/v3/pet/210" \
-H "api_key: <YOUR_API_KEY>" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "name=Krypto" \
--data-urlencode "status=available"
POST "https://petstore3.swagger.io/api/v3/pet/210" \
-H "accept: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "name=Krypto" \
--data-urlencode "status=available"
Responsesโ
| Code | Description |
|---|---|
| 200 | Successful operation |
| 405 | Invalid input |
| default | Unexpected error |
Response exampleโ
200: Successful operation
{
"id": 210,
"name": "Krypto",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
Parametersโ
Path parametersโ
| Name | Type | Description |
|---|---|---|
| petId | integer | ID of pet to update |
Query parametersโ
| Name | Type | Description |
|---|---|---|
| name | string | Name of pet to update |
| status | string | Status of pet to update |
Deleting a petโ
Deletes a pet from the database.
Endpoint: https://petstore3.swagger.io/api/v3/pet/{petId}
Operation: DELETE
Examplesโ
- API Key
- OAuth 2.0
DELETE "https://petstore3.swagger.io/api/v3/pet/210" \
-H "api_key: <YOUR_API_KEY>"
DELETE "https://petstore3.swagger.io/api/v3/pet/210" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>"
Responsesโ
| Code | Description |
|---|---|
| 200 | Pet deleted |
| 400 | Invalid ID supplied |
| 404 | Pet not found |
(A successful deletion returns a 200 code with no response body.)
Parametersโ
Path parametersโ
| Name | Type | Description |
|---|---|---|
| petId | integer | ID of pet to delete |
Uploading an imageโ
Uploads an image for a pet.
Endpoint: https://petstore3.swagger.io/api/v3/pet/{petId}/uploadImage
Operation: POST
Examplesโ
- API Key
- OAuth 2.0
POST "https://petstore3.swagger.io/api/v3/pet/210/uploadImage" \
-H "accept: application/json" \
-H "Content-Type: multipart/form-data" \
-H "api_key: <YOUR_API_KEY>" \
--form "file=@/path/to/your/file"
POST "https://petstore3.swagger.io/api/v3/pet/210/uploadImage" \
-H "accept: application/json" \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>" \
--form "file=@/path/to/your/file"
Responsesโ
| Code | Description |
|---|---|
| 200 | Successful operation |
| default | Unexpected error |
Response examplesโ
200: Successful operation
{
"code": 200,
"type": "unknown",
"message": "additional data"
}
Parametersโ
Path parametersโ
| Name | Type | Description |
|---|---|---|
| petId | integer | ID of pet to update |
Form data parametersโ
| Name | Type | Description |
|---|---|---|
| additionalMetadata | string | Extra data to pass to server. |
| file | file | File to upload. |