[#78] Error calling editBook function

Migrated from Redmine #78 | Author: DENY LESTER COELLO
Status: New | Priority: Normal | Created: 2017-12-17


hello,

I’m calling the editBook function and I’m getting this error:

{“code”:-32000,“message”:“No entry is registered for key ‘user’”,“data”:null}

What does it mean, what am I doing wrong?

here is the full response in case you need to track the request id:

{“error”:{“code”:-32000,“message”:“No entry is registered for key ‘user’”,“data”:null},“id”:“1871707248”,“jsonrpc”:“2.0”}

thanks

Dmytro Bondarev wrote:

Please provide full request.

DENY LESTER COELLO wrote:

here is the full request json

{“id”:“1996622104”,“jsonrpc”:“2.0”,“method”:“editBook”,“params”:[5,1,4,1,“2017-12-17”,“10:00:00”,“2017-12-17”,“05:00:00”,false,null]}

DENY LESTER COELLO wrote:

Dmitry Bondarev wrote:

Please provide full request.

Done!

Dmytro Bondarev wrote:

Please provide headers.
You can remove your sensitive data.

DENY LESTER COELLO wrote:

Hi,
I have been debugging and i cant capture the headers. Fyi, im able to pull the bookings using the same header in case if any. I do one request after the otherone but the second one gives me that error. Do tou still think is related to the headers?

Thanks

Dmytro Bondarev wrote:

Yes. I still think it is because of wrong token headers.

DENY LESTER COELLO wrote:

I setup a proxy so I can record the interaction with the API.

here is the full request response. I’m sending the same headers when I call the getBookings function and I have no error. However when I call editBook
this is what I get:

   {
  "predicates": [
    {
      "deepEquals": {
        "headers": {
          "Content-Type": "application/json-rpc",
          "x-company-login": "sleeping",
          "x-token": "f328936e51b206b6d392945820ad135197a1fb1084654602629bc8fcc176a009",
          "Cache-Control": "no-cache",
          "Pragma": "no-cache",
          "User-Agent": "Java/1.7.0_80",
          "Host": "192.168.99.100:3535",
          "Accept": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2",
          "Connection": "keep-alive",
          "Content-Length": "133"
        }
      }
    },
    {
      "deepEquals": {
        "body": "{\"id\":\"1009146949\",\"jsonrpc\":\"2.0\",\"method\":\"editBook\",\"params\":[5,1,4,1,\"2017-12-17\",\"10:00:00\",\"2017-12-17\",\"05:00:00\",false,null]}"
      }
    }
  ],
  "responses": [
    {
      "is": {
        "statusCode": 200,
        "headers": {
          "Server": "nginx/1.1.19",
          "Date": "Wed, 20 Dec 2017 03:12:06 GMT",
          "Content-Type": "application/json",
          "Content-Length": 121,
          "Connection": "keep-alive",
          "Keep-Alive": "timeout=20",
          "X-Powered-By": "PHP/5.3.10-1ubuntu3.21",
          "Access-Control-Allow-Origin": "*",
          "Access-Control-Allow-Methods": "POST, GET, OPTIONS",
          "Access-Control-Allow-Headers": "content-type, x-company-login, x-application-token, x-user-token, x-token, x-requested-with"
        },
        "body": "{\"error\":{\"code\":-32000,\"message\":\"No entry is registered for key 'user'\",\"data\":null},\"id\":\"1009146949\",\"jsonrpc\":\"2.0\"}",
        "_mode": "text",
        "_proxyResponseTime": 369
      }
    }
  ]
}

Dmytro Bondarev wrote:

First of all i see that you are using x-token.
But for admin API (where editBook is allowed) you have to use x-user-token.

Please see API documentation | SimplyBook.me Online Scheduling
User/Admin API (Company administration service) authorization section.

DENY LESTER COELLO wrote:

problem solved! I was also calling the wrong methods to get the token. It is working now.

Thanks a lot