system
1
Migrated from Redmine #581 | Author: Unnur Sól Ingimarsdóttir
Status: New | Priority: High, I’m very impatient | Created: 2020-10-09
Hi I’m using the api to book a service and I always get: Error: Client name value is wrong.
My call looks like this:
this.client
.request(“book”, {
eventId: “1”,
unitId: “1”,
date: this.formatDateForAPI(this.state.selectedDate),
time: this.state.startTimeMatrix[0],
clientData: {
name: “Unnur Sól Ingimarsdóttir”,
email: “unnursol95@gmail.com”,
phone: “6161710”,
},
additional: {
products: [{ id: “2”, qty: 1 }],
“4561427a918691b06302a9419e197b2f”:
data[“4561427a918691b06302a9419e197b2f”],
“9bc774570e6a7f5f8d9bc3c9b89e1cad”:
data[“9bc774570e6a7f5f8d9bc3c9b89e1cad”],
“5a446567067b410d32958f7d236bd92a”:
data[“5a446567067b410d32958f7d236bd92a”],
},
productIds: [“1”],
})
Isn’t this the right way to do it? Do I need to register client before I book?
system
2
Dmytro Bondarev wrote:
Hi. Please provide raw HTTP request.
And please pass non named parameters to functions. (see documentation for more details)
system
3
Redmine Admin wrote:
Hi,
you need to register client BEFORE only if client login custom feature is enabled.
Please use our API explorer API documentation | SimplyBook.me Online Scheduling (you can provide your account login and access token there) to see http request example, will be someething like this
POST https: HTTP/1.1
Host: user-api.simplybook.me
Content-Type: application/json; charset=UTF-8
Content-Length: 150
X-Company-Login: mib
X-Token: 6ae71c00cec45d86c77c15b0ebf56b931724d01d64701488874fc93f5506396c
Accept: application/json
{"jsonrpc":"2.0","method":"book","params":["1","1","2020-10-09","18:30:00",{"name":"Mike","email":"test@test.com","phone":"+3451234567"},{},1],"id":7}
system
4
Unnur Sól Ingimarsdóttir wrote:
Dmitry Bondarev wrote:
Hi. Please provide raw HTTP request.
And please pass non named parameters to functions. (see documentation for more details)
Is this enough information? 
system
5
Unnur Sól Ingimarsdóttir wrote:
Redmine Admin wrote:
Hi,
you need to register client BEFORE only if client login custom feature is enabled.
Please use our API explorer API documentation | SimplyBook.me Online Scheduling (you can provide your account login and access token there) to see http request example, will be someething like this
[…]
Thank you! 
system
6
Unnur Sól Ingimarsdóttir wrote:
Unnur Sól Ingimarsdóttir wrote:
Dmitry Bondarev wrote:
Hi. Please provide raw HTTP request.
And please pass non named parameters to functions. (see documentation for more details)
Is this enough information? 
:authority: user-api.simplybook.me
:method: POST
:path: /
:scheme: https
accept: /
accept-encoding: gzip, deflate, br
accept-language: is-IS,is;q=0.9,en-US;q=0.8,en;q=0.7
cache-control: no-cache
content-length: 389
content-type: application/json
origin: http://localhost:8000
pragma: no-cache
referer: http://localhost:8000/bokanir
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: cross-site
user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
x-company-login: ******
x-token: *******
{“jsonrpc”:“2.0”,“method”:“book”,“params”:{“eventId”:“19”,“unitId”:“1”,“date”:“2020-10-09”,“clientData”:{“name”:“Unnur Sól Ingimarsdóttir”,“email”:"unnursol95@gmail.com",“phone”:“6161710”},“additional”:{“products”:[{“id”:“2”,“qty”:1}],“4561427a918691b06302a9419e197b2f”:“OL081”,“9bc774570e6a7f5f8d9bc3c9b89e1cad”:“”,“5a446567067b410d32958f7d236bd92a”:“”},“productIds”:[“6”,“5”]},“id”:13}
system
7
Redmine Admin wrote:
Params must be an array not object, only client is object there
"params":["19","1","2020-10-09",{"name":"Unnur Sól Ingimarsdóttir","email":"unnursol95@gmail.com","phone":"6161710"},{"products":[{"id":"2","qty":1}],"4561427a918691b06302a9419e197b2f":"OL081","9bc774570e6a7f5f8d9bc3c9b89e1cad":"","5a446567067b410d32958f7d236bd92a":""},"productIds":["6","5"]},"id":13]
system
8
Unnur Sól Ingimarsdóttir wrote:
Redmine Admin wrote:
Params must be an array not object, only client is object there
[…]
{“jsonrpc”:“2.0”,“method”:“book”,“params”:[“19”,“1”,“2020-10-09”,“12:30:00”,{“name”:“Unnur Sól Ingimarsdóttir”,“email”:"unnursol95@gmail.com",“phone”:“6161710”},{“products”:[{“id”:“2”,“qty”:1}],“4561427a918691b06302a9419e197b2f”:“OL081”,“9bc774570e6a7f5f8d9bc3c9b89e1cad”:“”,“5a446567067b410d32958f7d236bd92a”:“”},{“productIds”:[“6”,“5”]}],“id”:12}
Now my request look like this and I get Error: Selected unit id is not available even though this unit id is available.
system
9
Redmine Admin wrote:
this means it is not available. Please go trough API explorer and choose this unit id and available time to check
system
10
Unnur Sól Ingimarsdóttir wrote:
Unnur Sól Ingimarsdóttir wrote:
Redmine Admin wrote:
Params must be an array not object, only client is object there
[…]
{“jsonrpc”:“2.0”,“method”:“book”,“params”:[“19”,“1”,“2020-10-09”,“12:30:00”,{“name”:“Unnur Sól Ingimarsdóttir”,“email”:"unnursol95@gmail.com",“phone”:“6161710”},{“products”:[{“id”:“2”,“qty”:1}],“4561427a918691b06302a9419e197b2f”:“OL081”,“9bc774570e6a7f5f8d9bc3c9b89e1cad”:“”,“5a446567067b410d32958f7d236bd92a”:“”},{“productIds”:[“6”,“5”]}],“id”:12}
Now my request look like this and I get Error: Selected unit id is not available even though this unit id is available.
I took out “productIds” and it worked, thank you!