Wiki

Clone wiki

API-2.0 / Location_for_booking

Method: POST

Path: /booking/location

Return location based on provided address details.

IMPORTANT:

  • Default location will always be returned (does not matter which address provided) if multiple location feature is not available (see Get settings features -> multiple_locations) or turned "off" (see Get settings features -> booking -> location), i.e. you might want to use default location (see Get settings default_location) right away.
  • BUT if multiple location feature is available and tuned "on":
    • if requested address includes zip, zip will be used to find location
    • if requested address does not include zip, there will be attempt to geocode address and get zip
    • if zip code not provided and geocode does not help:
      • if account preferences are book using default location (see Location policy), default location will be returned
      • if account preferenes are block booking, error (see Location policy) will be returned

Request Schema:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Calculate location request",
  "type": "object",

  "properties": {
    "address": {
        "type": ["string", "null"],
        "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
    }
  }
}

Where:

  • address (optional) is street address part of booking address
  • city (optional) is city part of booking address
  • state (optional) is state part of booking address
  • zip (optional) is zip code (postal code) part of booking address

At least on of optional parameters must be provided

Example of response JSON

{
  "id": 1,
  "name": "Default"
}

Example request:

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

curl -H "Content-Type: application/json" \
     -X POST -k \
     -d '{"zip": "100"}' \
      https://acme-sandbox.l27.co/latest/booking/location

Updated