Тема: Generate Locator using api
How i can generate locater using remote api.
Вы не вошли. Пожалуйста, войдите или зарегистрируйтесь.
How i can generate locater using remote 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=...
Thank you Rual, Please find the below request
http://**********/wialon/ajax.html?svc=token/update¶ms={"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?
"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.
Rual , Thank you very much
That's helpful; I was struggling with a similar issue...
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¶ms={"callMode":"create","app":"locator","at":0,"dur":'.$totalSegundos.',"fl":-1,"p":"{\"note\":\"test\",\"zones\":1,\"tracks\":1}","items":['.$unitId.']}&sid='.$sid
Denisse
You should add the resource id to "items" param, because of this you can only load all or none from each resource.
No, it's don't work, because in Locator only load the geofences that you need to see. Any other solution?