[#878] API /bookings : providerId mandatory

Migrated from Redmine #878 | Author: Thomas Lair
Status: Feedback | Priority: High, I’m very impatient | Created: 2022-05-03


Hello,

I am trying to create a booking via API but I only have the serviceId to fill in. The response says that the provideId field is mandatory. However I have the “all employees” plugin activated. Can you tell me how to make the call to POST/bookings without filling in the providerId? I tried empty and null value.

Thanks in advance.

Thomas.

Redmine Admin wrote:

there is no support of this plugin in API, you need to decide which provider to use

Marie Rajon wrote:

Hello, I am also working on this matter, and I had seen on this ticket : [Support #312: book & update without providerID - API - Simplybook.me support for developers] that with the any provider custom feature we didn’t have to specify the provider.
Our webshop doesn’t have the information about which provider should be used for a booking, and we’d like SBM to automatically assign the provider. Is there a way to do that trhough the APIs ?

Dmytro Bondarev wrote:

Hi,
You are using REST API, which is for admin side and this parameter is required.
You can use JSON RPC API if need it.

Marie Rajon wrote:

Thank you, we’ll look that up and come back to you if we have more questions.

Marie Rajon wrote:

Hello, with the Any provider plugin, does the proxy provider (the virtual provider defined in the plugin) has a provider id that can be used in the API requiring a provider id ?

Thomas Lair wrote:

Hello,

Thank you for your answer but it seems that the provider id is also mandatory with the JSON-RPC API.

I tried with the following requests:

POST https://user-api.simplybook.me
{“jsonrpc”:“2.0”,“method”:“book”,“params”:[“1”,null,“2022-05-04”,“18:00:00”,{“name":“test”,“email”:"test@test.com”,“phone”:“0000000”},{},1],“id”:7}

POST https://user-api.simplybook.me
{“jsonrpc”:“2.0”,“method”:“book”,“params”:[“1”,“”,“2022-05-04”,“18:00:00”,{“name":“test”,“email”:"test@test.com”,“phone”:“0000000”},{},1],“id”:7}

POST https://user-api.simplybook.me
{“jsonrpc”:“2.0”,“method”:“book”,“params”:[“1”,“null”,“2022-05-04”,“18:00:00”,{“name":“test”,“email”:"test@test.com”,“phone”:“0000000”},{},1],“id”:7}

but I still have the error: “Selected unit id is not available”.

Do you know how to do without provider id, or provide a virtual provider id as Benoit mentioned ?

Thank you in advance for your help.

Thomas Lair wrote:

Hello,

Do you have any information on the topics of my previous message?

Thank you in advance for your help.

Redmine Admin wrote:

hi, provider id is ALWAYS mandatory. There is no any provider support in API, you need to write own code which will check provider’s availability and assign random available provider if you need it.