1

Generate Locator using api

Тема: Generate Locator using api

How i can generate locater using remote api.

2

Generate Locator using api

Re: Generate Locator using api

You need to create token.

Sufficient access flags is 0x100.

p field must be an object:

{
    "note": "Optional note",
    "zones": 1 or 0,
    "tracks": 1 or 0,
    "sensorMasks": ["sensor masks", "with ? and/or *", ...]
}

All fields are optional.

Then just generate link https://hosting.wialon.com/locator/index.html?t=...

3

Generate Locator using api

(26/10/2017 11:01:40 отредактировано mabed)

Re: Generate Locator using api

Thank you  Rual, Please find the below request
http://**********/wialon/ajax.html?svc=token/update&params={"callMode":"create","userId":"14143","app":"locator","at":"0","dur":"1700","fl":"256","p":{"note":"Mohammad","zones":"0","tracks":"1","sensorMasks":[]},"items":[12181],"deleteAll":"0"}&sid=013eab5839f39c02a08da934643ad727

after send request always getting error 4
can you tell me what is the problem?

4

Generate Locator using api

Re: Generate Locator using api

"p" must be a string.

You can create locator link from wialon and see what request was actually sent:

{"callMode":"create","app":"locator","at":0,"dur":86400,"fl":256,"p":"{\"note\":\"test\",\"zones\":0,\"tracks\":0}","items":[1072]}

And dur, fl, at are integers, not strings.

Also, in this particular case this may be not required, but it is better to encodeURIComponent (in language that you are using must be an equivalent) params argument.

5

Generate Locator using api

Re: Generate Locator using api

Rual , Thank you very much

6

Generate Locator using api

Re: Generate Locator using api

That's helpful; I was struggling with a similar issue...

7

Generate Locator using api

Re: Generate Locator using api

How can you add geofences in the token generate for locator with API? I try to add the value 1 but the locator only I see the unit.

My request with var in php

https://hst-api.wialon.com/wialon/ajax.html?svc=token/update&params={"callMode":"create","app":"locator","at":0,"dur":'.$totalSegundos.',"fl":-1,"p":"{\"note\":\"test\",\"zones\":1,\"tracks\":1}","items":['.$unitId.']}&sid='.$sid
8

Generate Locator using api

Re: Generate Locator using api

Denisse

You should add the resource id to "items" param, because of this you can only load all or none from each resource.

9

Generate Locator using api

Re: Generate Locator using api

No, it's don't work, because in Locator only load the geofences that you need to see. Any other solution?