[#559] how to create Booking with any unit feature using API?

Migrated from Redmine #559 | Author: MOZ ZOM
Status: New | Priority: High, I’m very impatient | Created: 2020-08-20


Hi, I am creating an app to let customers do the followings step consequentially:

  1. select locations (I have this feature enabled)
  2. select event (Services)
  3. select Date & Time (All available Date and Time of the event within the location)
  4. booking

I have no problem getting necessary data from the first 2 steps using getLocatiosList() and getEventList() functions.
However, when I try the getServiceAvailableTimeIntervals() function, it requires unitId of which I would like to randomise.
Similarly, how do I use book() if I wish to randomise the unit at given Date, Time, Location and Event?
I did enabled the any unit feature.

Redmine Admin wrote:

Hi, yes, you always need to pass unitId or array of unitIds to getServiceAvailableTimeIntervals (yes, it can be array of unitIds)

MOZ ZOM wrote:

Thank you very much.
I am now troubled by “book” api.
I’ve tried to pass data put keep failing.

How to I property construct my data if

  1. I have location enabled
  2. I have additional filed enabled

Thank you.

MOZ ZOM wrote:

I tried to pass array of units, it does not work.
Does this mean I have to get the available unit up and running? Thank you

Redmine Admin wrote:

Hi, you always need to pass only single unit id into book function