Creates a new hamster
POST
/hamsters
const url = 'https://example.com/api/hamsters';const options = { method: 'POST', headers: { Authorization: 'Bearer <token>', 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams({id: '1', name: '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/hamsters \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data id=1 \ --data name=exampleAuthorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Hamster to add
object
id
required
integer format: int64
name
required
string
Examplegenerated
id=1&name=exampleobject
id
required
integer format: int64
name
required
string
Examplegenerated
{ "id": 1, "name": "example"}Responses
Section titled “Responses”Animal response
Media typeapplication/json
object
id
required
integer format: int64
name
required
Name of the animal
A friendly name for the animal.
string
tag
string
Example
{ "id": 1, "name": "dog", "tag": "pet"}default
Section titled “default”Unexpected error
Media typeapplication/json
object
code
required
integer format: int32
message
required
string
Examplegenerated
{ "code": 1, "message": "example"}