1

Access Template Create/Update/Delete for an User

Тема: Access Template Create/Update/Delete for an User

Hi Gurtam Support,

I am using update_custom_property remote API to create access templates for an user but every time when I hit the API I am getting back error code 4 which is Invalid Input.

I wrapped all the parameter values with double quotes properly ( sample req show below ) , can you please let me know how to achieve this ?

svc:item/update_custom_property
sid:0144d3156d2395604e3eecfcc1ac608b

params:
{
"itemId":14033536,
"name":"access_templates",
"value":
"{
\"avl_unit\":
[
{\"id\":0,\"name\":\"No access\",\"acl\":0,\"color\":\"rgb(232, 201, 162)\"},
{\"acl\":-1,\"name\":\"Full access\",\"color\":\"rgb(232, 164, 162)\",\"id\":1},
{\"acl\":567795534839,\"name\":\"Admin\",\"id\":2,\"color\":\"rgb(242, 190, 235)\"},{\"acl\":567795532791,\"name\":\"Supervisor\",\"id\":3,\"color\":\"rgb(192, 184, 249)\"},
{\"acl\":550024266275,\"name\":\"Read Only\",\"id\":4,\"color\":\"rgb(190, 242, 207)\"},
{\"acl\":880333094883,\"name\":\"GK\",\"color\":\"rgb(184, 215, 249)\",\"id\":5}
],
\"avl_unit_group\":
[
{\"id\":0,\"name\":\"No access\",\"color\":\"rgb(255, 217, 191)\",\"acl\":0},
{\"acl\":-1,\"name\":\"Full access\",\"color\":\"rgb(232, 164, 162)\",\"id\":1},
{\"acl\":567795535863,\"name\":\"Admin\",\"id\":2,\"color\":\"rgb(242, 190, 235)\"},{\"acl\":567795533815,\"name\":\"Supervisor\",\"id\":3,\"color\":\"rgb(192, 184, 249)\"},
{\"acl\":550024266275,\"name\":\"Read Only\",\"id\":4,\"color\":\"rgb(190, 242, 207)\"}
],
\"avl_resource\":
[
{\"id\":0,\"name\":\"No access\",\"color\":\"rgb(255, 217, 191)\",\"acl\":0},
{\"acl\":-1,\"name\":\"Full access\",\"color\":\"rgb(232, 164, 162)\",\"id\":1},
{\"acl\":52806609292279,\"name\":\"Admin\",\"color\":\"rgb(241, 198, 252)\",\"id\":2},{\"acl\":52806609290231,\"name\":\"Supervisor\",\"color\":\"rgb(162, 170, 219)\",\"id\":3},
{\"acl\":17602203107875,\"name\":\"Read Only\",\"color\":\"rgb(198, 252, 200)\",\"id\":4}
],
\"avl_route\":
[
{\"id\":0,\"name\":\"No access\",\"color\":\"rgb(255, 217, 191)\",\"acl\":0},
{\"id\":1,\"name\":\"Full access\",\"color\":\"rgb(211, 191, 229)\",\"acl\":-1},
{\"id\":2,\"name\":\"Read only\",\"color\":\"rgb(191, 212, 242)\",\"acl\":16931}
],
\"user\":
[
{\"id\":0,\"name\":\"No access\",\"color\":\"rgb(255, 217, 191)\",\"acl\":0},
{\"acl\":-1,\"name\":\"Full access\",\"color\":\"rgb(232, 164, 162)\",\"id\":1},
{\"acl\":6310903,\"name\":\"Admin\",\"id\":2,\"color\":\"rgb(242, 190, 235)\"},
{\"acl\":2114551,\"name\":\"Supervisor\",\"id\":3,\"color\":\"rgb(192, 184, 249)\"},
{\"acl\":16931,\"name\":\"Read Only\",\"id\":4,\"color\":\"rgb(190, 242, 207)\"}
]
}"
}

  • Access Template Create/Update/Delete for an User
2

Access Template Create/Update/Delete for an User

Re: Access Template Create/Update/Delete for an User

karthik, try to remove all line breaks and send request as one string

Head of Wialon Local Department
Gurtam
3

Access Template Create/Update/Delete for an User

Re: Access Template Create/Update/Delete for an User

Deal,

I am using remote API client tool called PostMan to test the wialon API's, and in postman if I use the payload as part of http body I am getting error code 4 and if I send it via http params the same API was successful ( I attached both the options screen shot here ) - But other API's all are working fine with http body and only the update_custom_property API is failing.

Let me know what is the correct way to consume the wialon remote API - Do we need to send the payloads via http parameters or can we pass via body ?

Thanks in advance
KarthikG

  • Access Template Create/Update/Delete for an User
4

Access Template Create/Update/Delete for an User

Re: Access Template Create/Update/Delete for an User

karthik, just set option x-www-form-urlencoded.

Head of Wialon Local Department
Gurtam
5

Access Template Create/Update/Delete for an User

Re: Access Template Create/Update/Delete for an User

Thanks Deal,

will try it out and confirm you.

Thanks
Karthik