[#468] EditServiceProvider API not working

Migrated from Redmine #468 | Author: omar Naseef
Status: Closed | Priority: Immediate, there is BUG! | Created: 2020-02-01


I’m trying to connect a service to a service provider using the editserviceprovider function. I get a success response back, however when I look at the service provider in SimplyBook, the service is not connected to it. Here’s the json i’m sending and the response i get back.

{
“jsonrpc”: “2.0”,
“method”: “editServiceProvider”,
“params”: [
23,
[{
“name” : “The New Bike Path”,
“locations” : [6],
“services”: [
20,21,22,23,24,25,26,26,28,29,30
] }]
],
“id”: 1
}

{
“result”: {
“result”: true,
“id”: “23”
},
“id”: “1”,
“jsonrpc”: “2.0”
}

Redmine Admin wrote:

Hi, which user you are using to do this? If it is junior employee then services will not be saved

omar Naseef wrote:

I am using the admin user to make the call.

Redmine Admin wrote:

please provide raw http request and your company login to check

omar Naseef wrote:

Here’s the raw http request. I modified the X-User-Token

POST /admin HTTP/1.1
Content-Type: application/json
X-User-Token:
X-Company-Login: ludoit
User-Agent: PostmanRuntime/7.22.0
Accept: /
Cache-Control: no-cache
Postman-Token: a2df7cd8-65a3-4b4f-87fd-eb8041987818
Host: user-api.simplybook.me
Accept-Encoding: gzip, deflate, br
Content-Length: 300
Connection: keep-alive
{
“jsonrpc”: “2.0”,
“method”: “editServiceProvider”,
“params”: [
23,
[{
“name” : “The New Bike Path”,
“locations” : [6],
“services”: [
20,21,22,23,24,25,26,26,28,29,30
] }]
],
“id”: 1
}
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 05 Feb 2020 17:21:38 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 61
Connection: keep-alive
Keep-Alive: timeout=20
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
X-XSS-Protection: 1; mode=block
{“result”:{“result”:true,“id”:“23”},“id”:“1”,“jsonrpc”:“2.0”}

Redmine Admin wrote:

there is no services with ids 24,25,26,26,28 in your account
if there is any problem with services list then it will not be saved but the rest info will be saved, so function return success.

omar Naseef wrote:

OK, so I updated it to send the following, which is valid:

{
“jsonrpc”: “2.0”,
“method”: “editServiceProvider”,
“params”: [
23,
[{
“name” : “The New Bike Path”,
“services”: [
20
] }]
],
“id”: 1
}

and still, nothing changes. The name doesn’t update, the services aren’t connected to the provider.

Redmine Admin wrote:

"params": [
23,
{
"name" : "The New Bike Path",
"locations" : [6],
"services": [
20
] }
]

please try following params

omar Naseef wrote:

That worked. Thank you for the help.