Migrated from Redmine #728 | Author: David Beale
Status: New | Priority: Normal | Created: 2021-07-05
When trying to execute method getBookingReport - (API documentation | SimplyBook.me Online Scheduling)
I receive error, ‘Method not found’
{‘error’: {‘code’: -32601, ‘message’: ‘Method not found’, ‘data’: None}, ‘id’: ‘1’, ‘jsonrpc’: ‘2.0’}
My payload - {‘method’: ‘getBookingReport’, ‘params’: , ‘jsonrpc’: ‘2.0’, ‘id’: 1}
Redmine Admin wrote:
please make sure you are using admin API not client API (this report is not available for client API)
David Beale wrote:
Thanks - sorry, didn’t read the docs enough.
I am now executing this method - but receiving and HTTP Response code of 500, could this be because I have provided no filters for this initial test?
David
Redmine Admin wrote:
please provide raw http request
David Beale wrote:
Here’s output of my Request
***** url *******
https://user-api.simplybook.me/admin
***** headers *******
{‘User-Agent’: ‘python-requests/2.25.1’, ‘Accept-Encoding’: ‘gzip, deflate’, ‘Accept’: ‘/’, ‘Connection’: ‘keep-alive’, ‘X-Company-Login’: ‘isisaquaski’, ‘X-User-Token’: ‘f614f1df1f3e6082168bf32e044a84cf2424c32d2bfdb4fb8c5e29767ebd8459’, ‘Content-Length’: ‘71’, ‘Content-Type’: ‘application/json’}
***** body *******
b’{“method”: “getBookingReport”, “params”: , “jsonrpc”: “2.0”, “id”: 1}’
***** response *****
<Response [500]>
Redmine Admin wrote:
please make sure you are getting tocken using this method
var token = loginClient.getUserToken( YOUR_COMPANY_LOGIN, YOUR_USER_LOGIN, YOUR_USER_PASSWORD);
and user has higher access level than viewer
David Beale wrote:
Thanks for your response.
I am successfully retrieving and using the user token, I was previously receiving ‘Access Denied’.
I’m guessing a 500 is caused by not providing enough data for the data to be queries, i.e. a data range?
David Beale wrote:
Hello,
The call is now working and I am getting +many+ results (I had to ensure params was populated).
Two questions now:
-
How to correctly format the filter parameters - I have experimented, but so far ignored - below is an example:
‘{“method”: “getBookingReport”, “params”: [{“date_from”: “2021-07-01 07:00:00”, “date_to”: “2021-07-04 07:00:00”, “booking_type”: “cancelled”, “order”: “start_date”}], “jsonrpc”: “2.0”, “id”: 1}’
-
The results are paginated, but how do I iterate through the pages.
Thanks