Wiki

Clone wiki

API-2.0 / Cancel_booking

API method DEPRECATED, please use Cancel booking for customer instead


Method: DELETE

Path: /api/bookings/id

Cancel existing booking.

This call requires authentication so X-Authentication header must be present.

Parameters: id (required)

Selected booking id.

Optional query parameters:

  • If cancelling will incur late cancellation fees, operation will fail with 406 responce code unless confirmed with cancel_late=true query parameter.

  • If cancelling recurring booking, operation will fail with 406 responce code unless confirmed with cancel_recurring=true query parameter.

  • If cancelling recurring booking, by default only selected booking is cancelled. If you want to cancel current and all future bookings, pass cancel_future=true query parameter.

Example response JSON

{"booking":{
  "id":57,
  "user_id":2,
  "service_date":"2015-08-15T13:00",
  "services":[{
    "id":1,
    "extras":[{
      "extra_id":1,
      "quantity":1
    }],
    "pricing_parameters":[{
      "pricing_parameter_id":1,
      "quantity":1
    }],
    "service_maids":1,
    "service_minutes":60
  },{
    "id":2,
    "extras":[],
    "pricing_parameters":[],
    "service_maids":1,
    "service_minutes":120
  }],
  "frequency_id":1,
  "address":"595 Market St",
  "city":"San Francisco",
  "state":"CA",
  "zip":"94105",
  "phone":"462-485-0790",
  "price":"202.0",
  "final_price":"202.0",
  "completed":false,
  "payment_method":"stripe",
  "active":false,
  "discount_code":null,
  "customer_comments":null,
  "sms_notifications":false,
  "flexibility":0,
  "custom_fields":{
    "custom_text":"text",
    "custom_dropdown":{"values":"1"},
    "custom_radio":{"values":"2"}
  }
}}

Example requests:

For production, replace https://acme-sandbox.l27.co with https://<your subdomain>.launch27.com

(1) First, get auth token for user@email.com:

curl -H "X-API-Key: test_8kBFkhmf8TA7TZyQBh" \
    -H "Content-Type: application/json" \
    -X POST -k \
    -d '{"auth": {"email": "user@email.com", "password":"trustno1"}}' \
    https://acme-sandbox.l27.co/api/auth
returns
{"user":{
  "id":2,
  "email":"user@email.com",
  "single_access_token":"JZR39nBOtg89JyyqmeI",
  "first_name":"First",
  "last_name":"Last"
}}
(2) Update booking for user@email.com Customer:
curl -H "X-API-Key: test_8kBFkhmf8TA7TZyQBh" \
     -H "X-Authentication: user@email.com:JZR39nBOtg89JyyqmeI" \
     -H "Content-Type: application/json" \
     -H "Accept: application/launch27.v2" \
     -X DELETE -k \
     https://acme-sandbox.l27.co/api/bookings/57

Updated