All URIs are relative to https://petstore3.swagger.io/api/v3
Method | HTTP request | Description |
---|---|---|
add_pet | POST /pet | Add a new pet to the store |
delete_pet | DELETE /pet/{petId} | Deletes a pet |
find_pets_by_status | GET /pet/findByStatus | Finds Pets by status |
find_pets_by_tags | GET /pet/findByTags | Finds Pets by tags |
get_pet_by_id | GET /pet/{petId} | Find pet by ID |
update_pet | PUT /pet | Update an existing pet |
update_pet_with_form | POST /pet/{petId} | Updates a pet in the store with form data |
upload_file | POST /pet/{petId}/uploadImage | uploads an image |
Pet add_pet(body)
Add a new pet to the store
Add a new pet to the store
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
configuration = swagger_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi(swagger_client.ApiClient(configuration))
body = swagger_client.Pet() # Pet | Create a new pet in the store
try:
# Add a new pet to the store
api_response = api_instance.add_pet(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->add_pet: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
body | Pet | Create a new pet in the store |
- Content-Type: application/json, application/xml, application/x-www-form-urlencoded
- Accept: application/json, application/xml
[Back to top] [Back to API list] [Back to Model list] [Back to README]
delete_pet(pet_id, api_key=api_key)
Deletes a pet
delete a pet
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
configuration = swagger_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi(swagger_client.ApiClient(configuration))
pet_id = 789 # int | Pet id to delete
api_key = 'api_key_example' # str | (optional)
try:
# Deletes a pet
api_instance.delete_pet(pet_id, api_key=api_key)
except ApiException as e:
print("Exception when calling PetApi->delete_pet: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
pet_id | int | Pet id to delete | |
api_key | str | [optional] |
void (empty response body)
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[Pet] find_pets_by_status(status=status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
configuration = swagger_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi(swagger_client.ApiClient(configuration))
status = 'available' # str | Status values that need to be considered for filter (optional) (default to available)
try:
# Finds Pets by status
api_response = api_instance.find_pets_by_status(status=status)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
status | str | Status values that need to be considered for filter | [optional] [default to available] |
- Content-Type: Not defined
- Accept: application/json, application/xml
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[Pet] find_pets_by_tags(tags=tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
configuration = swagger_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi(swagger_client.ApiClient(configuration))
tags = ['tags_example'] # list[str] | Tags to filter by (optional)
try:
# Finds Pets by tags
api_response = api_instance.find_pets_by_tags(tags=tags)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
tags | list[str] | Tags to filter by | [optional] |
- Content-Type: Not defined
- Accept: application/json, application/xml
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Pet get_pet_by_id(pet_id)
Find pet by ID
Returns a single pet
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: api_key
configuration = swagger_client.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'
# Configure OAuth2 access token for authorization: petstore_auth
configuration = swagger_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi(swagger_client.ApiClient(configuration))
pet_id = 789 # int | ID of pet to return
try:
# Find pet by ID
api_response = api_instance.get_pet_by_id(pet_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
pet_id | int | ID of pet to return |
- Content-Type: Not defined
- Accept: application/json, application/xml
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Pet update_pet(body)
Update an existing pet
Update an existing pet by Id
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
configuration = swagger_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi(swagger_client.ApiClient(configuration))
body = swagger_client.Pet() # Pet | Update an existent pet in the store
try:
# Update an existing pet
api_response = api_instance.update_pet(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->update_pet: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
body | Pet | Update an existent pet in the store |
- Content-Type: application/json, application/xml, application/x-www-form-urlencoded
- Accept: application/json, application/xml
[Back to top] [Back to API list] [Back to Model list] [Back to README]
update_pet_with_form(pet_id, name=name, status=status)
Updates a pet in the store with form data
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
configuration = swagger_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi(swagger_client.ApiClient(configuration))
pet_id = 789 # int | ID of pet that needs to be updated
name = 'name_example' # str | Name of pet that needs to be updated (optional)
status = 'status_example' # str | Status of pet that needs to be updated (optional)
try:
# Updates a pet in the store with form data
api_instance.update_pet_with_form(pet_id, name=name, status=status)
except ApiException as e:
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
pet_id | int | ID of pet that needs to be updated | |
name | str | Name of pet that needs to be updated | [optional] |
status | str | Status of pet that needs to be updated | [optional] |
void (empty response body)
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ApiResponse upload_file(pet_id, body=body, additional_metadata=additional_metadata)
uploads an image
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
configuration = swagger_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi(swagger_client.ApiClient(configuration))
pet_id = 789 # int | ID of pet to update
body = swagger_client.Object() # Object | (optional)
additional_metadata = 'additional_metadata_example' # str | Additional Metadata (optional)
try:
# uploads an image
api_response = api_instance.upload_file(pet_id, body=body, additional_metadata=additional_metadata)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->upload_file: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
pet_id | int | ID of pet to update | |
body | Object | [optional] | |
additional_metadata | str | Additional Metadata | [optional] |
- Content-Type: application/octet-stream
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]