REST API Example
Add a new pet
This endpoint adds a new pet in the database.
Authentication
Authentication is done using a bearer token obtained from the /auth/getToken
endpoint.
post
/pets/add/
Body
Headers
Queries
Params
Cookies
JSON
application/json
{
"name": "The pet name",
"type": "The pet type (dog, bird, etc.)",
"breed": "The pet breed (optional)"
}
XML
application/xml
<Data>
<Property1>string</Property1>
<Property2>number</Property2>
</Data>
Form Data
multipart/form-data
Name | Type | Required |
---|---|---|
name | string | required |
The pet name | ||
type | string | required |
The pet type (dog, bird, etc.) | ||
breed | string | optional |
The pet breed |
Form Urlencoded
application/x-www-form-urlencoded
Name | Type | Required |
---|---|---|
name | string | required |
The pet name | ||
type | string | required |
The pet type (dog, bird, etc.) | ||
breed | string | optional |
The pet breed |
text/csv
A CSV file with columns 'name', 'type', and 'breed'
Name | Description |
---|---|
Content-Type | |
The content type of the body |
Name | Type | Required |
---|---|---|
xml | boolean | optional |
If present, the response type would be XML instead of JSON |
Name | Type | Description |
---|---|---|
database | string | |
The database name to add the pet in |
Name | Description |
---|---|
trackerid | |
The tracker ID |
Response
Body
Headers
Cookies
JSON
application/json
{
"success": true,
"message": "string"
}
XML
application/xml
<Data>
<Property1>string</Property1>
<Property2>number</Property2>
</Data>
Name | Description |
---|---|
Content-Type | |
The content type of the body |
Name | Description |
---|---|
trackerid | |
The tracker ID |
Example
post
/pets/add/petsDb?xml=true
Body
Headers
Cookies
JSON
application/json
{
"name": "Bob",
"type": "Pig",
"breed": "Miniature Pig"
}
Name | Value |
---|---|
Content-Type | application/json |
Name | Value |
---|---|
trackerid | ge8s7ecs69er8vfseasdg0s8d6fgvsdf |
Response Example
200
OK
Body
Headers
Cookies
XML
application/xml
<Message>
<Type>Success</Type>
<Text>Pet Bob was added.</Text>
</Message>
Name | Value |
---|---|
Content-Type | application/xml |
Name | Value |
---|---|
trackerid | ge8s7ecs69er8vfseasdg0s8d6fgvsdf |