[#1029] Issue with JSON-RPC request for reservation information

Migrated from Redmine #1029 | Author: byungwook kang
Status: Closed | Priority: High, I’m very impatient | Created: 2023-03-21


Dear Support Team,

I am writing to report an issue with a JSON-RPC request that I sent to your system for retrieving reservation information. I used the following command to send the request:

curl -i -X ​​POSTS
-H “Content-Type:application/json; charset=UTF-8”
-H “X-Company-Login:<COMPANY_LOGIN>”
-H “X-User-Token:<USER_TOKEN>”
-d
'{
“jsonrpc”: “2.0”,
“method”: “getBookings”,
“params”: {},
“id”:0
}

https://user-api.simplybook.me/admin

However, instead of receiving the expected response with the reservation information, I received the following error message:

{
“error”: {
“code”: -32011,
“message”: “Params is not array”,
“data”: [
]
},
“id”: “0”,
“jsonrpc”: “2.0”
}

The error message suggests that there was a problem with the “params” field in the request, as it was not recognized as an array. I have reviewed the JSON-RPC specification and checked the request data, but I cannot find any issues with the formatting.

Can you please investigate this issue and provide me with guidance on how to resolve it? I need to retrieve the reservation information as soon as possible, so any assistance you can provide would be greatly appreciated.

Thank you for your attention to this matter.

Best regards,

Redmine Admin wrote:

Based on the error message you received, the issue seems to be related to the “params” field not being recognized as an array. In JSON-RPC, the “params” field is an array that contains the parameters of the method being called.

It’s possible that the issue is caused by an empty “params” field. In your request, you are passing an empty object “{}” as the value for the “params” field. Instead, you should pass an empty array “” as the value for the “params” field:

json

{
  "jsonrpc": "2.0",
  "method": "getBookings",
  "params": [],
  "id": 0
}

By passing an empty array as the value for the “params” field, you are indicating that there are no parameters to be passed to the “getBookings” method.

If you continue to experience issues with your JSON-RPC request, I recommend reaching out to SimplyBook.me support for further assistance. They may be able to provide additional guidance on how to format your request correctly.

byungwook kang wrote:

Redmine Admin wrote:

Based on the error message you received, the issue seems to be related to the “params” field not being recognized as an array. In JSON-RPC, the “params” field is an array that contains the parameters of the method being called.

It’s possible that the issue is caused by an empty “params” field. In your request, you are passing an empty object “{}” as the value for the “params” field. Instead, you should pass an empty array “” as the value for the “params” field:

json

[…]
By passing an empty array as the value for the “params” field, you are indicating that there are no parameters to be passed to the “getBookings” method.

If you continue to experience issues with your JSON-RPC request, I recommend reaching out to SimplyBook.me support for further assistance. They may be able to provide additional guidance on how to format your request correctly.

I followed the guidance you provided regarding the issue with my JSON-RPC request, but I am still experiencing the same error message. Specifically, I updated the “params” field to pass an empty array “” instead of an empty object “{}” as you suggested. However, the error message persists.

I will contact the SimplyBook.me support team as you gave me the guide. Thank you.

Thank you for your help.

Dmytro Bondarev wrote:

Hi, please try following request:

{
  "jsonrpc": "2.0",
  "method": "getBookings",
  "params": [{}],
  "id":0
}

Following parameters are allowed:

'date_from', 'date_to', 'time_from', 'time_to', 'created_date_from', 'created_date_to', 'edited_date_from', 'edited_date_to', 'unit_group_id', 'event_id', 'is_confirmed', 'client_id', 'client_email', 'client_phone', 'order', 'limit', 'booking_type', 'tickets_validation', 'medical_test_status', 'upcoming_only', 'referral_plugin_promo_id', 'referral_plugin_promo_client_id', 'code', 'page', 'on_page',

byungwook kang wrote:

I am glad to report that the guide you provided has resolved the issue I was facing.
Thank you for your help and guidance!