Add a new pet to the store.
POST
/pet
curl -X POST 'https://petstore3.swagger.io/api/v3/pet' \ -H 'Content-Type: application/json' \ -d '{"category":{"id":1,"name":"Dogs"},"id":10,"name":"doggie","photoUrls":["string"],"status":"available","tags":[{"id":0,"name":"string"}]}'package main
import ( "context" "net/http" "strings")
func main() { ctx := context.Background() body := strings.NewReader(`{"category":{"id":1,"name":"Dogs"},"id":10,"name":"doggie","photoUrls":["string"],"status":"available","tags":[{"id":0,"name":"string"}]}`) req, err := http.NewRequestWithContext(ctx, "POST", "https://petstore3.swagger.io/api/v3/pet", body) if err != nil { panic(err) } req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close()}import requests
response = requests.request( "POST", "https://petstore3.swagger.io/api/v3/pet", headers={"Content-Type": "application/json"}, data='{"category":{"id":1,"name":"Dogs"},"id":10,"name":"doggie","photoUrls":["string"],"status":"available","tags":[{"id":0,"name":"string"}]}',)print(response.json())const response = await fetch('https://petstore3.swagger.io/api/v3/pet', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({"category":{"id":1,"name":"Dogs"},"id":10,"name":"doggie","photoUrls":["string"],"status":"available","tags":[{"id":0,"name":"string"}]}),});const data = await response.json();Add a new pet to the store.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”Create a new pet in the store
object
category
object
id
integer format: int64
Example
1 name
string
Example
Dogs id
integer format: int64
Example
10 name
required
string
Example
doggie photoUrls
required
Array<string>
status
Pet status in the store
string
tags
Array<object>
object
id
integer format: int64
name
string
object
category
object
id
integer format: int64
Example
1 name
string
Example
Dogs id
integer format: int64
Example
10 name
required
string
Example
doggie photoUrls
required
Array<string>
status
Pet status in the store
string
tags
Array<object>
object
id
integer format: int64
name
string
object
category
object
id
integer format: int64
Example
1 name
string
Example
Dogs id
integer format: int64
Example
10 name
required
string
Example
doggie photoUrls
required
Array<string>
status
Pet status in the store
string
tags
Array<object>
object
id
integer format: int64
name
string
Responses
Section titled “ Responses ”Successful operation
object
category
object
id
integer format: int64
name
string
id
integer format: int64
name
required
string
photoUrls
required
Array<string>
status
Pet status in the store
string
tags
Array<object>
object
id
integer format: int64
name
string
Example
{ "category": { "id": 1, "name": "Dogs" }, "id": 10, "name": "doggie", "status": "available"}object
category
object
id
integer format: int64
Example
1 name
string
Example
Dogs id
integer format: int64
Example
10 name
required
string
Example
doggie photoUrls
required
Array<string>
status
Pet status in the store
string
tags
Array<object>
object
id
integer format: int64
name
string
Invalid input
Validation exception
default
Section titled “default ”Unexpected error