1

cannot create driver

Topic: cannot create driver

Hi guys, I am trying this request:

http://hst-api.wialon.com/wialon/ajax.html?svc=resource/update_driver&sid=XXXXXXXX2903ca02b3042698612f19e0&params={"itemId":12198150,"id":0,"callMode":"create","c":"0000000000PYZ001","ds":"none","f":4,"n":"first lastname","p":""}

and I keep getting error 7, what could be the problem? if needed I can send in PM the login i use

2

cannot create driver

Re: cannot create driver

Hello

error 7 - Access denied code

Check your ACL to resource with "itemId":12198150 and ensure you have "Create driver" enabled

3

cannot create driver

Re: cannot create driver

thanks, yes I noticed err 7 is access denied. The account where I try to create the driver has full access, incl Resources - ACL

4

cannot create driver

Re: cannot create driver

Check your token access_flags

You need at least
0x100 - to view drivers (default access_flags value)
0x800 - to create/edit//delete

5

cannot create driver

Re: cannot create driver

I use flag -1, the exact request is

http://mysite.com/login.html?client_id= … duration=0

after that i send user/pass to this form to login and get token from its navigated url

6

cannot create driver

Re: cannot create driver

Lets try to execute following request

http://hst-api.wialon.com/wialon/ajax.html?svc=core/search_item&params={"id":12198150,"flags":1}&sid=

and check "cls" and "uacl" fields in response

7

cannot create driver

Re: cannot create driver

thanks, response is

{"item":{"nm":"XXXX","cls":1,"id":12198150,"mu":0,"uacl":2146947},"flags":1}

8

cannot create driver

Re: cannot create driver

venellinus wrote:

thanks, response is

{"item":{"nm":"XXXX","cls":1,"id":12198150,"mu":0,"uacl":2146947},"flags":1}

Ok, now its clear
This item is user ("cls": 1) and for resource/update_driver you have to send resource id

9

cannot create driver

Re: cannot create driver

yes that is correct, this item is user and its resource id is 12198150. This user is created as sub account of another "top" account. Using same api request at the top of this thread but the resource ID of the top account i can create driver under "top" account. Question is what has to be enabled to allow the subaccount  to create drivers

10

cannot create driver

Re: cannot create driver

venellinus wrote:

this item is user and its resource id is 12198150

User and account (resource) are different instances, and you can't create driver in user.

Try this request and you'll see "bact" - account (resource) id of this user

http://hst-api.wialon.com/wialon/ajax.html?svc=core/search_item&params={"id":12198150,"flags":5}&sid=
11

cannot create driver

Re: cannot create driver

Ok shmi,

i got the info from support, that if i have a master account which has subaccounts and each subaccount need to have its own driver ans each vehicle is sending ddd files and needs to be analysed by each individual account and each subuser should NOT see all 1000 drivers from all subusers than i need to create for each subuser a ressource and now i can add drivers for each subuser.
Only not via the API?

Wolf.

Politeness dictates it to write his name on a post
12

cannot create driver

Re: cannot create driver

Hi Wolf

First of all CMS and Hosting sites works via Remote API so everything you can do in interface can be implemented via Remote API. The only problem is to understand exactly what do you need.

We can't split 1000 drivers from same resource to grant access to different users, so if you need separate drivers lists for users - you have to create drivers in different resources and grant each user access to needed.

Logic here is pretty straightforward
- login with master account with token/login
- create user using core/create_user or find existing using core/search_items - in response you'll get userId
- create resource for user (creatorId = userId) using core/create_resource - in response you'll get resourceId
- Optionally - you can convert new resource into account account/create_account
- create driver in new resource (itemId = resourceId) with resource/update_driver

In first message of topic you are sending itemId=userId instead of itemId=resourceId for resource/update_driver

Please give me to know is something still unclear

13

cannot create driver

Re: cannot create driver

thanks shmi, i think i start to understand what i am doing wrong. Only one thing is not clear atm - when I  create resource for user - what flag should I specify?

14

cannot create driver

Re: cannot create driver

i tried with flag 1 but received error 1002:

http://hst-api.wialon.com/wialon/ajax.html?svc=core/create_resource&params={"creatorId":12198150,  "name":"test1","dataFlags":1, "skipCreatorCheck":1}&sid=

with flag 256 i get same error

15

cannot create driver

Re: cannot create driver

venellinus, error 1002 means that such resource name (test1) already exists. Pass another resource name.

Head of Wialon Local Department
Gurtam
16

cannot create driver

Re: cannot create driver

thanks, actually it is even simpler, we have the resources already created(manually). I just need to search for resourceID , driver creation works then ok
thanks both of you for your help smile

17

cannot create driver

Re: cannot create driver

I am developing an new App where I use Wialon API to log in a Driver with phonenumber and password.
With the Drivers operate request:
https://sdk.wialon.com/wiki/en/kit/remo … er_operate
But how is it possible to login a Driver that is not bind to a unit yet?