addAnimal
POST
/animals
const url = 'https://example.com/api/animals';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"name":"example","tag":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/animals \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "tag": "example" }'Creates a new animal
Request Body
Section titled “Request Body”Animal to add
A representation of an animal
object
name
required
string
tag
string
key
additional properties
number
Examplegenerated
{ "name": "example", "tag": "example"}A representation of an animal
object
name
required
string
tag
string
key
additional properties
number
Responses
Section titled “Responses”Animal response
object
name
required
string
tag
string
id
required
integer format: int64
Examplegenerated
{ "name": "example", "tag": "example", "id": 1}object
name
required
string
tag
string
id
required
integer format: int64
default
Section titled “default”Unexpected error
object
code
required
integer format: int32
message
required
string
Examplegenerated
{ "code": 1, "message": "example"}object
code
required
integer format: int32
message
required
string