Wiki

Clone wiki

API-2.0 / Get_bookings

API method DEPRECATED, please use Get bookings for customer instead


Method: GET

Path: /api/bookings

Get customer bookings. If no from/to query params present, returns non-completed bookings with today's and later service date.

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

Query parameters:

from (optional)

Return bookings with service date on or after from. The date should be in YYYY-MM-DD format and is always interpreted as local date in client timezone.

to (optional)

Return bookings with service before or on to. The date should be in YYYY-MM-DD format and is always interpreted as local date in client timezone.

limit (optional)

offset (optional)

Return only limit number of bookings optionally offset bookings from the start.

Example response JSON

{"bookings":[{
  "id":18,
  "user_id":2,
  "service_date":"2015-05-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
  }],
  "frequency_id":1,
  "address":"595 Market St",
  "city":"San Francisco",
  "state":"CA",
  "zip":"94105",
  "phone":"462-485-0790",
  "price":"132.0",
  "final_price":"132.0",
  "completed":true,
  "payment_method":"stripe",
  "active":true,
  "discount_code":null,
  "customer_comments":null,
  "sms_notifications":false,
  "flexibility":0,
  "custom_fields":{}
}]}

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) And get bookings 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 GET -k \
     https://acme-sandbox.l27.co/api/bookings?from=2015-05-01&to=2015-07-01&limit=10

Updated