Wiki

Clone wiki

API-2.0 / Custom_fields_for_booking

Method: GET

Path: /booking/custom_fields

Return list of booking custom fields.

Query params

booking_uuid (optional)

Booking digest. MUST be provided if custom fields requested for existing booking. (requires authentication)

Example of response

[
  {
    "id": 25,
    "code": "custom_drop_down",
    "label": "Drop Down",
    "control_type": "drop_down",
    "value_required": false,
    "visible": true,
    "ordering": 0,
    "default_value": "aaa",
    "options": [
      {
        "id": 2,
        "label": "AAA",
        "value": "aaa",
        "order": 0,
        "other": false,
        "default": false,
        "active": true
      },
      {
        "id": 3,
        "label": "BBB",
        "value": "bbb",
        "order": 0,
        "other": false,
        "default": false,
        "active": true
      }
    ]
  },
  {
    "id": 250,
    "code": "custom_single_line",
    "label": "Why?",
    "control_type": "single_line",
    "value_required": false,
    "visible": true,
    "ordering": 0,
    "default_value": "",
    "help_text": ""
  },
  {
    "id": 248,
    "code": "custom_checkboxes",
    "label": "Any?",
    "control_type": "checkboxes",
    "value_required": true,
    "visible": true,
    "ordering": 0,
    "default_value": "aaa",
    "help_text": "",
    "options": [
      {
        "id": 6,
        "label": "AAA",
        "value": "aaa",
        "order": 0,
        "other": false,
        "default": true,
        "active": true
      },
      {
        "id": 8,
        "label": "BBB",
        "value": "bbb",
        "order": 1,
        "other": false,
        "default": false,
        "active": true
      }
    ]
  },
  {
    "id": 247,
    "code": "dont_worry_text",
    "label": "",
    "control_type": "plain_text",
    "value_required": false,
    "visible": true,
    "ordering": 52,
    "text": "Don't worry, you won't be billed until the day of service and you will receive an email receipt instantly. We no longer accept cash or checks.",
    "settings": {
      "before_submit_button": true
    }
  }
]
Where:

  • custom field attributes:
    • id is custom field unique ID
    • code is unique value for custom field, automatically assigned when custom field crated
    • label is custom field label, value could be empty
    • control_type is type of UI control that should be used for custom field, possible control types:
      • single_line expected single line UI input element
      • multi_line expected multi line (text area) UI input element
      • radio_buttons expected group of radiobuttons UI input element, only one value allowed to be selected
      • checkboxes expected group of checkboxes UI input element, more than one value allowed to be selected
      • drop_down expected a dropdown (select) UI input element, only one value allowed to be selected
      • plain_text expected to be displayed as plain text, custom field does not accept any values
      • date expected datepicker or similar UI input element, value supposed to be provided in format YYYY-MM-DD (example "2006-01-02")
      • datetime expected datetimepicker or similar UI input element, value supposed to be provided in format YYYY-MM-DDTHH:MM:SS (example "2006-01-02T15:04:05")
      • checkbox expected single checkbox or switch UI input element, value supposed to be "true" or "false" (also could be empty if custom field value is not value_required).
    • value_required value is true if custom field configured as requires value
    • visible value is true if custom field configured as visible (i.e. not hidden)
    • ordering is configured order of custom field in the list of custom fields
    • default_value may or may not be configured for custom field; if configured supposed to be pre-entered for new booking, but NOT for existing booking (i.e. if booking_uuid parameter used to query custom fields)
    • help_text may or may not be configured
    • text may or may not present for custom fields with control_type: single_line, multi_line, plain_text, date, datetime or checkbox
    • settings present only for custom fields with control_type: plain_text or checkbox
    • options present only for custom fields with multi-choice control_type: radio_buttons, checkboxes or drop_down
  • options attributes:
    • id is custom field option unique ID
    • label is custom field option label
    • value is custom field option value; option should be pre-selected if curresponds to custom field's default_value
    • order is configured order for custom field option in the list of custom field options
    • other if true means that if option selected it is required to provide additional explanation, i.e. display free text UI input element for option if option selected. Note: it is possible that more than one option of the same custom field has other = true
    • default if true means that option configured as default, supposed to be pre-selected for new booking, but NOT for existing booking (i.e. if booking_uuid parameter used to query custom fields)
    • active always true if custom fields requested for new booking (i.e. parameter booking_uuid was not used), otherwise (i.e. parameter booking_uuid was used) may be false if option was selected for booking while option was active
  • settings attributes:
    • before_submit_button if true custom field expected to be displayed before booking form submit button; could be plain_text text and/or accept terms and conditions checkbox

Example request:

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

curl -H "Content-Type: application/json" \
     -X GET -k \
     https://acme-sandbox.l27.co/latest/booking/custom_fields

Example request (as logged-in):

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 GET -k \
     https://acme-sandbox.l27.co/latest/booking/custom_fields?booking_uuid=NcUHgV93Vkf7Jxgr8P6rvOi3DMLpYvc2

Updated