Wiki

Clone wiki

API-2.0 / Update_booking_for_customer

Method: PUT

Path: /customer/bookings/:id

Updates booking


IMPORTANT: do not call this API endpoint simultaneously for different bookings with the same discount_code to prevent discount code (discount, giftcard, reward) overuse.


id (required)

Booking unique ID (see Get bookings for customer).

Request schema:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Update booking request",
    "type": "object",
    "properties": {
        "location_id": {
            "type": ["integer", "null"]
        },
        "address": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
        },
        "city": {
            "type": ["string", "null"],
            "minLength": 1,
            "maxLength": 100
        },
        "state": {
            "type": ["string", "null"],
            "minLength": 1,
            "maxLength": 3
        },
        "zip": {
            "type": ["string", "null"],
            "minLength": 1,
            "maxLength": 10
        },
        "phone": {
            "type": ["string", "null"],
            "minLength": 1,
            "maxLength": 20
        },
        "sms_notifications": {
            "type": ["boolean", "null"]
        },
        "frequency_id": {
            "type": "integer",
            "minimum": 1
        },
        "service_date": {
            "type": "string",
            "pattern": "\\A\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\z"
        },
        "arrival_window": {
            "title": "arrival window in minutes",
            "type": "integer",
            "minimum": 0,
            "maximum": 1440
        },
        "services": {
            "type": "array",
            "items": {
                "title": "Service",
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "hourly": {
                        "type": ["object", "null"],
                        "properties": {
                            "quantity": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100
                            },
                            "minutes": {
                                "type": "integer",
                                "minimum": 30,
                                "maximum": 1440,
                                "multipleOf": 30
                            }
                        },
                        "required": ["quantity", "minutes"]
                    },
                    "extras": {
                        "type": ["array", "null"],
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "quantity": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 10000
                                },
                                "recurring": {
                                    "type": ["boolean", "null"]
                                }
                            },
                            "required": ["id", "quantity"]
                        }
                    },
                    "pricing_parameters": {
                        "type": ["array", "null"],
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer",
                                    "minimum": 1
                                },
                                "quantity": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 250000
                                }
                            },
                            "required": ["id", "quantity"]
                        }
                    }
                },
                "required": ["id"]
            },
            "minItems": 1
        },
        "discount_code": {
            "type": ["string", "null"],
            "minLength": 1,
            "maxLength": 255
        },
        "tip": {
            "type": ["number", "null"],
            "minimum": 0,
            "maximum": 100000
        },
        "tip_recurring": {
            "type": ["boolean", "null"]
        },
        "payment_method": {
            "type": "string",
            "enum": ["stripe", "paypal", "cash", "check"]
        },
        "customer_notes": {
            "type": ["string", "null"],
            "minLength": 1
        },
        "custom_fields": {
            "type": ["array", "null"],
            "items": {
                "oneOf": [{
                    "title": "Single-Line or Multi-Line values or Date (\\A\\d{4}-\\d{2}-\\d{2}\\z) or DateTime (\\A\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\z) or Checkbox (true or false)",
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "value": {
                            "type": "string",
                            "minLength": 0
                        }
                    },
                    "required": ["id", "value"],
                    "additionalProperties": false
                }, {
                    "title": "Radio buttons, drop downs or checkboxes values",
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "values": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "other": {
                                        "type": ["string", "null"]
                                    }
                                },
                                "required": ["id"]
                            },
                            "minItems": 0
                        }
                    },
                    "required": ["id", "values"],
                    "additionalProperties": false
                }]
            }
        }
    },
    "create_next_recurring": {
        "title": "Provide if user selected to create next recurring booking for old service date as part of rescheduling recurring booking",
        "type": ["object", "null"],
        "properties": {
            "service_date": {
                "type": "string",
                "pattern": "\\A\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\z"
            }
        },
        "required": ["service_date"]
    },
    "required": [
        "address",
        "frequency_id",
        "service_date",
        "arrival_window",
        "services",
        "payment_method"
    ]
}

Request attributes are similar to those in Create booking for customer with few exceptions:

  • not required and not expected attributes:
    • original_booking_id: it is not possible to change original_booking_id for existing booking
  • create_next_recurring (optional) should be provided only if customer wants to change service date for this recurring booking only and keep future bookings to "continue" from the unchanged service date; has attributes:
    • service_date (required) is service date of next booking to be created as part of booking update (use Next booking date for frequency to calculate next service date for booking frequency and unchanged service date)

Example request:

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

Replace BEARER_FROM_LOGIN with bearer from Login

curl -H "Content-Type: application/json" \
     -H 'Authorization: Bearer BEARER_FROM_LOGIN' \
     -X PUT -k \
     -d '{"address":"595 Market St", "city":"San Francisco", "state":"CA", "zip":"94105", "phone":"462-485-0790", "frequency_id": 1, "service_date": "2019-08-20T09:30:00", "arrival_window":0, "services":[{"id":1}],  "payment_method":"cash" }' \
      https://acme-sandbox.l27.co/latest/customer/bookings/1

Example of response

see Get booking for customer

Updated