For full functionality of this site it is necessary to enable JavaScript. Here are the instructions how to enable JavaScript in your web browser.
 You are using an out of date browser, we suggest you upgrade. You may continue if you wish, but aspects of the site may not function correctly.

Client

The client API enables you to list, create, update and query the clients (customers) registered against your company. You must be authenticated as an administrator to perform the API calls for client.

Create Client

The API enables an admin to create a client (customer). The following parameters listed below are supported.

Parameters

Name Type Description
first_name string First Name of the client
last_name string Last name of the client
email string email address of the client
mobile_prefix string Mobile prefix e.g. +44
mobile string Mobile number of the client
phone string Phone number of the client
address1 string Address line 1
address2 string Address line 2
address3 string Address line 3
address4 string Address line 4
address5 string Address line 5
postcode string Postcode
country string Name of country e.g. United Kingdom
reference string Client's Reference e.g. external reference
join_date string Client's joining date in ISO-8601
member_type integer Type of member e.g. 1 = contact 2= member
send_email string true/false
member_level_id integer Membership level id the client belongs to
default_company_id integer The default company the client should belong to
time_zone string Time zone of the client
POST /api/v1/admin/{company_id}/client
curl -X POST -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {auth-token}" 
  -H "Content-Type: application/json" 
  -H "Cache-Control: no-cache"
  -d '{
    "first_name": "Test Name",
    "last_name": "Test surname",
    "email": "test@test.com",
    "mobile_prefix": "+44",
    "mobile": "07912345678",
    "phone": "02032323232",
    "member_type": "2"
  }'
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/client"

Above is an example cURL call creating a new client. If you would like to update the same client, the method will be PUT and you will need to append the client ID in the URL.

List Clients

GET /api/v1/admin/{company_id}/client
curl -X GET -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {auth-token}" 
  -H "Content-Type: application/json" 
  -H "Cache-Control: no-cache"
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/client"
{
  "total_entries": 33,
  "_embedded": {
    "clients": [
      {
        "first_name": "Jamie",
        "last_name": "Oliver",
        "email": "j.oliver@test.com",
        "country": "United Kingdom",
        "id": 2897097,
        "member_type": 1,
        "reference": "",
        "files": [],
        "answers": [],
        "deleted": false,
        "phone_prefix": "44",
        "mobile_prefix": "44",
        "default_company_id": 50666,
        "q": {},
        "_links": {
          "self": {
            "href": "https://uk.bookingbug.com/api/v1/admin/50579/client/2897097"
          },
          "bookings": {
            "href": "https://uk.bookingbug.com/api/v1/admin/50579/bookings{/id}?client_id=2897097{&start_date,end_date,page,per_page,include_cancelled,modified_since,slot_id,event_id,resource_id,service_id,person_id,filter_by_fields,order_by,order_by_reverse,start_time,end_time,locale,clinic_id}",
            "templated": true
          },
          "pre_paid_bookings": {
            "href": "https://uk.bookingbug.com/api/v1/50579/members/2897097/pre_paid_bookings{?include_invalid,event_id}",
            "templated": true
          },
          "questions": {
            "href": "https://uk.bookingbug.com/api/v1/50579/client_details"
          },
          "edit": {
            "href": "https://uk.bookingbug.com/api/v1/admin/50579/client/2897097/edit"
          }
        }
      },
      ...
      ]
      ...
      }

Above is an example cURL call for listing all the clients. By default it will list 30 clients per page. You can use the per_page and page params for pagination.

Read Client

GET /api/v1/admin/{company_id}/client/{client_id}
curl -X GET -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {auth-token}" 
  -H "Content-Type: application/json" 
  -H "Cache-Control: no-cache"
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/client/{id}"

The above cURL call is an example of reading a client.

Delete Client

You can delete a client.

DELETE /api/v1/admin/{company_id}/client/{client_id}
curl -X DELETE -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {auth-token}" 
  -H "Content-Type: application/json" 
  -H "Cache-Control: no-cache"
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/client/{id}"

Disable/Enable Client

You can disable/enable a client using the API. The following paremeters listed below are supported. You only need to specify either the ID or the email of a client in the body payload.

Name Type Description
Id integer Client ID
email string Client email
disable boolean true/false
PUT /api/v1/admin/{company_id}/client/
curl -X PUT -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {auth-token}" 
  -H "Content-Type: application/json" 
  -H "Cache-Control: no-cache"
  -d '{ "id": 123456, "disable": true}'
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/client"

Find by email

You can query the client end-point to find a particular customer with their email address. You must be authenticated as an administrator.

GET /api/v1/admin/{company_id}/client/find_by_email/{email}
curl -X GET -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {token-token}"
  -H "Content-Type: application/json" 
  -H "Cache-Control: no-cache"
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/client/find_by_email/j.oliver@test.com"
{
  "first_name": "Jamie",
  "last_name": "Oliver",
  "email": "j.oliver@test.com",
  "country": "United Kingdom",
  "phone_prefix": "44",
  "mobile_prefix": "44",
  "id": 2897097,
  "answers": [],
  "deleted": false,
  "notifications": {},
  "client_type": "Member",
  "default_company_id": 50666,
  "reference": "",
  "_links": {
    "self": {
      "href": "https://uk.bookingbug.com/api/v1/50579/client/2897097"
    },
    "questions": {
      "href": "https://uk.bookingbug.com/api/v1/50579/client_details"
    }
  }
}

Find by reference

You can query the client end-point to find a particular customer with their reference. You must be authenticated as an administrator.

GET /api/v1/admin/{company_id}/client/find_by_ref/{reference}
curl -X GET -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {token-token}"
  -H "Content-Type: application/json" 
  -H "Cache-Control: no-cache"
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/client/find_by_ref/123456"
{
  "first_name": "Jamie",
  "last_name": "Oliver",
  "email": "j.oliver@test.com",
  "country": "United Kingdom",
  "phone_prefix": "44",
  "mobile_prefix": "44",
  "id": 2897097,
  "answers": [],
  "deleted": false,
  "notifications": {},
  "client_type": "Member",
  "default_company_id": 50666,
  "reference": "",
  "_links": {
    "self": {
      "href": "https://uk.bookingbug.com/api/v1/50579/client/2897097"
    },
    "questions": {
      "href": "https://uk.bookingbug.com/api/v1/50579/client_details"
    }
  }
}