Créer un type d'unité (chambre, emplacement…)
POST
/v1/unit-types
const url = 'https://example.com/v1/unit-types';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"establishmentId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","code":"example","name":"example","format":"hotel_room","baseCapacity":1,"headcountBillingMode":"per_person","housekeepingApplicable":true}'};
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/v1/unit-types \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "establishmentId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "code": "example", "name": "example", "format": "hotel_room", "baseCapacity": 1, "headcountBillingMode": "per_person", "housekeepingApplicable": true }'Authorizations
Section intitulée « Authorizations »Request Body required
Section intitulée « Request Body required » Media type application/json
object
establishmentId
required
string format: uuid
code
required
string
name
required
string
format
required
Format physique (hotel_room, camping_pitch…)
string
Example
hotel_room baseCapacity
required
integer
headcountBillingMode
required
string
Example
per_person housekeepingApplicable
boolean
Responses
Section intitulée « Responses »Type d’unité créé
Media type application/json
object
data
required
object
unitTypeId
required
string format: uuid
Example generated
{ "data": { "unitTypeId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }}Corps invalide
Media type application/json
object
code
required
Code machine de l’erreur
string
message
required
Message lisible
string
origin
Origine domaine de l’erreur (optionnel)
object
boundedContext
string
module
string
status
required
integer
traceId
required
Identifiant de corrélation pour le support
string
Example
{ "code": "RESERVATION_NOT_FOUND", "message": "Réservation introuvable", "status": 404}Non authentifié
Media type application/json
object
code
required
Code machine de l’erreur
string
message
required
Message lisible
string
origin
Origine domaine de l’erreur (optionnel)
object
boundedContext
string
module
string
status
required
integer
traceId
required
Identifiant de corrélation pour le support
string
Example
{ "code": "RESERVATION_NOT_FOUND", "message": "Réservation introuvable", "status": 404}Permission refusée
Media type application/json
object
code
required
Code machine de l’erreur
string
message
required
Message lisible
string
origin
Origine domaine de l’erreur (optionnel)
object
boundedContext
string
module
string
status
required
integer
traceId
required
Identifiant de corrélation pour le support
string
Example
{ "code": "RESERVATION_NOT_FOUND", "message": "Réservation introuvable", "status": 404}