[#993] How a client can get an access to him list of booking?

Migrated from Redmine #993 | Author: Артур Чернієвич
Status: Feedback | Priority: Immediate, there is BUG! | Created: 2022-12-26


Hello,

I need get all bookings list of client. But when I try get list by getClientBookings I get only one booking item. I know, that client has much more bookings.

I use getClientBookings ($clientId, $sign, $filter). Enter clientId and clientHash that get after make a booking.

And I always get only one booking.

I also notes that when we make a new booking then it creates new clientId and clientHash. Why?

I need help, please. I need get all booking list of client.

Redmine Admin wrote:

hi, if you don’t use client login feature then it will be unique client id per each booking

Артур Чернієвич wrote:

Ok, I already enabled Client Login feature.
Now I get error RPC Exception: -32068 Client authorization required.

But I made a client authorization, got clientId and it still shows me an error.

Redmine Admin wrote:

please provide your raw http request

Артур Чернієвич wrote:

Post: https://user-api-v2.simplybook.me/admin/clients
Headers: {Content-Type: application/json, X-Company-Login: andromonew, X-Token: 256b81c468fee98e7caf340fecc86d4d242572d1b78c8ca163e86e0470273e1b}
body: {“name":“sss”,“email”:"sss@gmail.com”,“phone”:“380950755445”}

Redmine Admin wrote:

https://user-api-v2.simplybook.me/admin/clients is to get list of all clients, no client should be passed there API documentation | SimplyBook.me Online Scheduling

Артур Чернієвич wrote:

I use POST method for create a client, and get clientId from response.

Артур Чернієвич wrote:

It worked before and now works. But when I want make a booking it show me error that client is not authorized.
RPC Exception: -32068 Client authorization required.

Redmine Admin wrote:

please provide raw http request from making boking, what you sent above is get client list

Артур Чернієвич wrote:

I make a booking via jsonRPC
{“jsonrpc”:“2.0”,“method”:“book”,“params”:[1,2,“2022-12-30”,“13:00:00”,{“name":“sss”,“email”:"sss@gmail.com”,“phone”:“380950755445”},,null,null,null],“id”:873448250}

Артур Чернієвич wrote:

When I disabled Client Login Futures then I got an success in make a booking.
{“result”:{“require_confirm”:true,“bookings”:[{“id”:“1”,“event_id”:3,“unit_id”:3,“client_id”:“4”,“client_hash”:“39f3168870bcdd1ecfbdc04f984bfee9”,“start_date_time”:“2022-12-29 13:00:00”,“end_date_time”:“2022-12-29 14:00:00”,“time_offset”:“0”,“is_confirmed”:“1”,“require_payment”:true,“code”:“38a0qct”,“hash”:“f407e59fb354ba96659a6887b4ff0f92”}],“invoice”:null},“id”:“534305167”,“jsonrpc”:“2.0”}

Redmine Admin wrote:

this way does not work if client login feature is enabled, it seems you enabled it and it did break your API integration

Redmine Admin wrote:

if client login is enabled then you need to use this method API documentation | SimplyBook.me Online Scheduling

Артур Чернієвич wrote:

I’ll try it now and get back to very soon

Артур Чернієвич wrote:

Which api_url need I provide when I want to initialization admin access to jsonRPC?

Also I got an error when was making a booking. “error”:{“code”:-32600,“message”:“Access denied”,“data”:},“id”:“125752490”,“jsonrpc”:“2.0”}

JSON RPC request {“jsonrpc”:“2.0”,“method”:“book”,“params”:[2,3,“2022-12-29”,“14:00:00”,“2022-12-29”,“14:00:00”,60,,null,null,null],“id”:125752490}

Артур Чернієвич wrote:

Please help me, the solution really important for me

Dmytro Bondarev wrote:

Hi, you should use: https://user-api.simplybook.me/admin
And use API documentation | SimplyBook.me Online Scheduling to get token.

Артур Чернієвич wrote:

Hi,

I tried to do it. But I can’t get user token.

The URL for admin login “https://user-api.simplybook.me/admin/login
Here is the data that jsonRPC sends {“jsonrpc”:“2.0”,“method”:“getUserToken”,“params”:[“andromonew”,“artur”,“AndromoTeam”],“id”:62511427}

It’s really admin’s data but I can’t get user token. Please test my data and tell me how can I fix it?

Артур Чернієвич wrote:

Here my response
{“error”:{“code”:-32600,“message”:“Invalid request”,“data”:},“id”:“734126246”,“jsonrpc”:“2.0”}

I want remind that all work for “https://user-api.simplybook.me/login”. And I use getToken method for get token. It really works.

Dmytro Bondarev wrote:

Hi, to get token you still should use https://user-api.simplybook.me/login , but to get admin token use different method @getUserToken@.
To use admin API methods you should use https://user-api.simplybook.me/admin . We didn’t say that you need to change login URL :slight_smile: