system
1
Migrated from Redmine #246 | Author: Daniel Horowitz
Status: New | Priority: Normal | Created: 2018-09-24
Hello,
We’ve been using Node JS API client for simplybook api and it’s been working great over the last 12months.
Now we’re getting 400 Bad request error.
Here I paste my raw HTTP request ( I only changed URL from http to https).
Options:
{ method: ‘POST’,
host: ‘https://user-api.simplybook.me’,
path: ‘/login’,
headers:
{ host: ‘https://user-api.simplybook.me’,
‘content-type’: ‘application/json’,
‘content-length’: 134 } }
Body:
{“jsonrpc”:“2.0”,“method”:“getToken”,“params”:[“smylendev”,“API_KEY”],“id”:0}
Can you please help us figuring out this issue?
system
2
Daniel Horowitz wrote:
It returns this error.
Client: TODO Status Code: 400
system
3
Redmine Admin wrote:
It is working fine for me with your account. Please provide raw http request
system
4
Daniel Horowitz wrote:
I already provided raw HTTP request above.
How do you test? On API documentation | SimplyBook.me Online Scheduling?
I use node.js wrapper I developed.
system
5
Redmine Admin wrote:
if it is raw http request then you need to replace API_KEY with real API KEY from plugin settings 
system
6
Daniel Horowitz wrote:
yes, I use real API KEY in code, I just replaced with literal ‘API_KEY’ to send you.
system
7
Redmine Admin wrote:
please do the following command and send us result
curl https://user-api.simplybook.me/login -X POST -H 'content-type: application/json' -d '{"jsonrpc":"2.0","method":"getToken","params":["smylendev","API_KEY"],"id":0}'
system
8
Daniel Horowitz wrote:
Here’s the response from CURL.
curl: (92) HTTP/2 stream 1 was not closed cleanly: REFUSED_STREAM (err 7)
system
9
Redmine Admin wrote:
this not looks like response from curl in console. Please run it directly in terminal
system
10
Daniel Horowitz wrote:
I ran this directly on mac OS terminal.
system
11
Redmine Admin wrote:
Please do the following
curl https://user-api.simplybook.me/login --http1.1 -i -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"getToken","params":["smylendev","api key"],"id":0}'
system
12
Redmine Admin wrote:
Please do the following
curl https://user-api.simplybook.me/login --http1.1 -i -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"getToken","params":["smylendev","api key"],"id":0}'
system
13
Daniel Horowitz wrote:
My api key is 244bb7e7c5b317c1aedc0a77731e12b7cdd5dc9e9b9adcb8ea1c05b2cda8f7e8
You can test it yourself.
system
14
Daniel Horowitz wrote:
Great, now it works.
How can we map additional params to node module?
–http1.1
-i
system
15
Redmine Admin wrote:
it is not additional param but protocol version. Please check node manual to choose right version