Hi !
When I try to make a request I got this message error :
-
code: “caligraph_invalid_payload”
-
errors: Array(1)
-
0:
1. code: "ycbm_api_http_invalid_payload"
2. field: "numberOfSlots"
3. message: "Expected value not provided"
4. object: "Booking"
5. __proto__: Object
-
length: 1
-
proto: Array(0)
-
httpStatusCode: 400
-
message: “Invalid payload”
-
status: “BAD_REQUEST”
-
type: "CaligraphExc
I tried to fix it by adding the parameter but it still giving me same message
Here is my code for the request :
create_booking(emailAddress,firstName,lastName)
{
///v1/{accountId}/profiles/{profileId}/bookings
fetch(info.BASE_URL+`/profiles/${get.profile_id}/bookings`,{
method:info.POST_METHOD,
//headers:this.getRequestHeaders('POST'),
headers:{
"Content-Type" : "application/json",
},
body:JSON.stringify({
appointmentTypeIds: [
"jsid2126175"
],
units: 1,
numberOfSlots: 1,
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
startsAt: "2021-07-07T09:00:00",
//numberOfSlots: '1',
answers: [
{
code: 'EMAIL',
string: emailAddress
}, {
code: 'FNAME',
string: firstName
}, {
code: 'LNAME',
string: lastName
}
]
})
})
.then(response =>response.json())
.then(json =>{
console.log(json);
})
.catch(error =>{
console.error(error);
})
},