Cancelling booking through API

Unable to cancel booking through the API. It’s also quite confusing in the docs that there are different ways to cancel it. Both PATCH /v1/intents/{intentId}/booking/cancel and PATCH https://api.youcanbook.me/v1/bookings/{bookingId}? I tried both and none work. Would love a solution to this.

@theapidev to that URL endpoint (https://api.youcanbook.me/v1/bookings/{bookingId}) you should be able to PATCH

{
  "cancelled" : true
}

Is this not working for you?

No unfortunately I keep getting this error:

{
  "code": "ycbm_api_booking_forbidden_operation",
  "errors": [],
  "httpCode": 403,
  "httpStatusCode": 403,
  "message": "Booking operation is not allowed",
  "status": "FORBIDDEN",
  "type": "YcbmApiException"
}

I’ve double checked the bookingId and the link multiple times, no luck so far… Also tried with new bookings. I can run GET on the same endpoint and it returns:

{
  "cancelled": false
}

But PATCH does not work. I’m including the {“cancelled”:true} body.

@theapidev I will send you a message here so I an more specific information about your requests.

Hi @Ben, jumping in here with a similar issue. The docs state “This is an unauthenticated endpoint” but it seems this error is thrown w/o credentials. Could you confirm?

@mullagatawny anytime you are looking to interact with the booking and not GET the information you will need to authenticated. It is recommended to always use the Basic Authentication for any requests to the API.

1 Like