[#202] API differ from SimplyBook records

Migrated from Redmine #202 | Author: Sam Holtby
Status: In Progress | Priority: Immediate, there is BUG! | Created: 2018-07-25


When calling the getBookings method(Company administration service methods - Company administration service methods - SimplyBook.me) with a client’s ID, the resulting amount of bookings are different from whats on the SimplyBook control panel.

I’ve had a look through the parameters for the getBookings method but can’t seem to resolve the issue.

This is quite urgent as my clients aren’t able to see all their bookings.

Redmine Admin wrote:

please provide full http request, response and what do you see in control pannel?

Sam Holtby wrote:

Here are the API results and an export of what is in the control panel. I’ve removed sensitive information as this is public.

Sam Holtby wrote:

Not sure if you’ve received the files as they aren’t showing as attached on my previous comment.

Redmine Admin wrote:

unfortunately file attachments are forbidden for security reasons here. Please paste text from files

Sam Holtby wrote:

Okey Here is the API result

Array
(
[0] => stdClass Object
(
[id] => 857
[record_date] => 2018-06-15 11:47:30
[start_date] => 2018-06-15 15:30:00
[end_date] => 2018-06-15 16:30:00
[unit_id] => 18
[event] => Outside Wash
[event_id] => 1
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rknsmp3
[status] => 4
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 15.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)

[1] => stdClass Object
(
[id] => 84
[record_date] => 2018-01-31 21:01:36
[start_date] => 2018-04-03 14:30:00
[end_date] => 2018-04-03 15:15:00
[unit_id] => 3
[event] => Outside Wash
[event_id] => 1
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk2bijn
[status] =>
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 15.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)

[2] => stdClass Object
(
[id] => 83
[record_date] => 2018-01-31 21:01:36
[start_date] => 2018-03-04 14:30:00
[end_date] => 2018-03-04 15:15:00
[unit_id] => 3



[event] => Outside Wash
[event_id] => 1
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk2a24t
[status] =>
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 15.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)

[3] => stdClass Object
(
[id] => 90
[record_date] => 2018-02-02 23:18:06
[start_date] => 2018-02-13 14:30:00
[end_date] => 2018-02-13 15:15:00
[unit_id] => 2
[event] => Outside Wash
[event_id] => 1
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk2hl3b
[status] =>
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 15.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)

[4] => stdClass Object
(
[id] => 93
[record_date] => 2018-02-09 12:33:58
[start_date] => 2018-02-09 15:45:00
[end_date] => 2018-02-09 16:30:00
[unit_id] => 1
[event_id] => 1
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk2k4f2
[status] =>
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 15.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)

[5] => stdClass Object
(
[id] => 92
[record_date] => 2018-02-05 17:01:21
[start_date] => 2018-02-05 20:15:00
[end_date] => 2018-02-05 21:00:00
[unit_id] => 1
[event] => Outside Wash
[event_id] => 1
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk2jqvb
[status] =>
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 15.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)

[6] => stdClass Object
(
[id] => 89
[record_date] => 2018-02-02 14:37:29
[start_date] => 2018-02-02 18:45:00
[end_date] => 2018-02-02 19:30:00
[unit_id] => 1
[event] => Outside Wash
[event_id] => 1
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk2g2l8
[status] =>
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 15.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)

[7] => stdClass Object
(
[id] => 88
[record_date] => 2018-02-02 14:17:24
[start_date] => 2018-02-02 18:00:00
[end_date] => 2018-02-02 19:30:00
[unit_id] => 3
[event] => Inside & Outside Wash
[event_id] => 2
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk2f5j9
[status] =>
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 12.5000
[payed_currency] => GBP
[promotion_code] => DROPLESS50
[promotion_discount] => 50.0000
)

[8] => stdClass Object
(
[id] => 82
[record_date] => 2018-01-31 21:01:36
[start_date] => 2018-02-02 14:30:00
[end_date] => 2018-02-02 15:15:00
[unit_id] => 3
[event] => Outside Wash
[event_id] => 1
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk29pw5
[status] =>
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 15.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)

[9] => stdClass Object
(
[id] => 81
[record_date] => 2018-01-29 23:19:18
[start_date] => 2018-01-30 14:30:00
[end_date] => 2018-01-30 15:15:00
[unit_id] => 3
[event] => Outside Wash
[event_id] => 1
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk28ccu
[status] =>
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 15.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)

[10] => stdClass Object
(
[id] => 77
[record_date] => 2018-01-27 18:05:49
[start_date] => 2018-01-29 15:00:00
[end_date] => 2018-01-29 16:30:00
[unit_id] => 2
[event_id] => 2
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk24s0u
[status] => 3
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 25.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)

[11] => stdClass Object
(
[id] => 64
[record_date] => 2018-01-24 22:03:02
[start_date] => 2018-01-25 15:00:00
[end_date] => 2018-01-25 15:45:00
[unit_id] => 1
[event] => Outside Wash
[event_id] => 1
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk1r57p
[status] => 3
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 15.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)

[12] => stdClass Object
(
[id] => 63
[record_date] => 2018-01-24 15:12:21
[start_date] => 2018-01-24 15:15:00
[end_date] => 2018-01-24 16:45:00
[unit_id] => 1
[event] => Inside & Outside Wash
[event_id] => 2
[is_confirm] => 0
[client_id] => 16
[client_phone] =>
[offset] => 0
[comment] =>
[code] => 2rk1q5q0
[status] =>
[payment_status] => paid
[payment_system] => delay
[payed_amount] => 25.0000
[payed_currency] => GBP
[promotion_code] =>
[promotion_discount] =>
)
)

And here is the export from SimplyBook

[
  {
    "Date": "09-08-2018",
    "Time": "20:30 - 21:30",
    "Event": "Outside Wash",
    "Code": "2rk86mm8",
    "Is cancelled": "No",
    "Record date": "2018-05-05 12:37:04",
    "Created by admin": "No",
    "Number of changes": 1,
    "price": 15,
    "Amount": 10.5,
    "Currency": "GBP"
  },
  {
    "Date": "05-07-2018",
    "Time": "08:30 - 09:30",
    "Event": "Outside Wash",
    "Code": "2rk854wl",
    "Is cancelled": "No",
    "Record date": "2018-05-05 12:37:04",
    "Created by admin": "No",
    "Number of changes": 2,
    "price": 15,
    "Amount": 10.5,
    "Currency": "GBP"
  },
  {
    "Date": "15-06-2018",
    "Time": "15:30 - 16:30",
    "Event": "Outside Wash",
    "Code": "2rknsmp3",
    "Is cancelled": "Yes",
    "Record date": "2018-06-15 11:47:30",
    "Created by admin": "Yes",
    "Number of changes": 0,
    "price": 15,
    "Amount": 15,
    "Currency": "GBP"
  },
  {
    "Date": "07-06-2018",
    "Time": "19:00 - 21:00",
    "Event": "Inside & Outside Wash",
    "Code": "2rk84la6",
    "Is cancelled": "Yes",
    "Record date": "2018-05-05 12:37:04",
    "Created by admin": "No",
    "Number of changes": 2,
    "price": 25,
    "Amount": 10.5,
    "Currency": "GBP"
  },
  {
    "Date": "05-05-2018",
    "Time": "14:15 - 15:15",
    "Event": "Outside Wash",
    "Code": "2rk83p55",
    "Is cancelled": "No",
    "Record date": "2018-05-05 12:37:04",
    "Created by admin": "No",
    "Number of changes": 2,
    "price": 15,
    "Amount": 10.5,
    "Currency": "GBP"
  },
  {
    "Date": "03-04-2018",
    "Time": "14:30 - 15:15",
    "Event": "Outside Wash",
    "Code": "2rk2bijn",
    "Is cancelled": "Yes",
    "Record date": "2018-01-31 21:01:36",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 15,
    "Amount": 15,
    "Currency": "GBP"
  },
  {
    "Date": "24-03-2018",
    "Time": "18:45 - 19:30",
    "Event": "Outside Wash",
    "Code": "2rk3dqua",
    "Is cancelled": "No",
    "Record date": "2018-03-24 14:34:47",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 15,
    "Amount": 15,
    "Currency": "GBP"
  },
  {
    "Date": "04-03-2018",
    "Time": "14:30 - 15:15",
    "Event": "Outside Wash",
    "Code": "2rk2a24t",
    "Is cancelled": "Yes",
    "Record date": "2018-01-31 21:01:36",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 15,
    "Amount": 15,
    "Currency": "GBP"
  },
  {
    "Date": "13-02-2018",
    "Time": "14:30 - 15:15",
    "Event": "Outside Wash",
    "Code": "2rk2hl3b",
    "Is cancelled": "Yes",
    "Record date": "2018-02-02 23:18:06",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 15,
    "Amount": 15,
    "Currency": "GBP"
  },
  {
    "Date": "09-02-2018",
    "Time": "15:45 - 16:30",
    "Event": "Outside Wash",
    "Code": "2rk2k4f2",
    "Is cancelled": "Yes",
    "Record date": "2018-02-09 12:33:58",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 15,
    "Amount": 15,
    "Currency": "GBP"
  },
  {
    "Date": "05-02-2018",
    "Time": "20:15 - 21:00",
    "Event": "Outside Wash",
    "Code": "2rk2jqvb",
    "Is cancelled": "Yes",
    "Record date": "2018-02-05 17:01:21",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 15,
    "Amount": 15,
    "Currency": "GBP"
  },
  {
    "Date": "02-02-2018",
    "Time": "18:45 - 19:30",
    "Event": "Outside Wash",
    "Code": "2rk2g2l8",
    "Is cancelled": "Yes",
    "Record date": "2018-02-02 14:37:29",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 15,
    "Amount": 15,
    "Currency": "GBP"
  },
  {
    "Date": "02-02-2018",
    "Time": "18:00 - 19:30",
    "Event": "Inside & Outside Wash",
    "Code": "2rk2f5j9",
    "Is cancelled": "Yes",
    "Record date": "2018-02-02 14:17:24",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 25,
    "Amount": 12.5,
    "Currency": "GBP"
  },
  {
    "Date": "02-02-2018",
    "Time": "14:30 - 15:15",
    "Event": "Outside Wash",
    "Code": "2rk29pw5",
    "Is cancelled": "Yes",
    "Record date": "2018-01-31 21:01:36",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 15,
    "Amount": 15,
    "Currency": "GBP"
  },
  {
    "Date": "30-01-2018",
    "Time": "14:30 - 15:15",
    "Event": "Outside Wash",
    "Code": "2rk28ccu",
    "Is cancelled": "Yes",
    "Record date": "2018-01-29 23:19:18",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 15,
    "Amount": 15,
    "Currency": "GBP"
  },
  {
    "Date": "29-01-2018",
    "Time": "15:00 - 16:30",
    "Event": "Inside & Outside Wash",
    "Code": "2rk24s0u",
    "Is cancelled": "Yes",
    "Record date": "2018-01-27 18:05:49",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 25,
    "Amount": 25,
    "Currency": "GBP"
  },
  {
    "Date": "25-01-2018",
    "Time": "15:00 - 15:45",
    "Event": "Outside Wash",
    "Code": "2rk1r57p",
    "Is cancelled": "Yes",
    "Record date": "2018-01-24 22:03:02",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 15,
    "Amount": 15,
    "Currency": "GBP"
  },
  {
    "Date": "24-01-2018",
    "Time": "15:15 - 16:45",
    "Event": "Inside & Outside Wash",
    "Code": "2rk1q5q0",
    "Is cancelled": "Yes",
    "Record date": "2018-01-24 15:12:21",
    "Created by admin": "No",
    "Number of changes": 0,
    "price": 25,
    "Amount": 25,
    "Currency": "GBP"
  }
]

Redmine Admin wrote:

it is not raw http request to our API

Sam Holtby wrote:

How would I gain this from the PHP JSON-RPC-client library that SimplyBook suggested to use? Found within the ‘Authorization’ section on API documentation | SimplyBook.me Online Scheduling.

Sam Holtby wrote:

Would this be ok?

{
  "URL": "http:\/\/user-api.simplybook.me\/admin\/",
  "http": {
    "method": "POST",
    "header": "Content-type: application\/json\r\nX-Company-Login: dropless\r\nX-User-Token: c5dcf9ea945a7cdfa81cf82e52fb63371acf6a4d1ab13cbe71c185be92668e8f\r\n",
    "content": "{\"method\":\"getBookings\",\"params\":[{\"client_id\":16}],\"id\":1}"
  }
}

Redmine Admin wrote:

You asked API to get bookings for client with id = 16. And comparing it with all bookings (not it can be same email but different client ids in export)

Dmytro Bondarev wrote:

Also take into account that you are getting all bookings, including cancelled. Pass is_confirmed = 1 to get only active bookings.

Sam Holtby wrote:

The data from SimplyBook Control Panel is only from the client 16 as far as I know. Also there is only one account with that email address in the system.

The API is returning 12 bookings for client 16. SimplyBook Control panel is showing 18.

Is there a way to get bookings via the clients email as the ID isn’t reliable?