In the previous sample, we've created, edited, and deleted a unit. Units (like users, retranslators, unit groups etc.) are independent items. However, there are sub-items in Wialon which exist as a part of an independent item. For instance, a resource can have such sub-items like geofences, notifications, jobs, POIs, drivers etc.
Standard operations with sub-items a bit differ from those with independent items. In this example, we'll examine creating, editing and deleting a POI as a sub-item of a resource.
Let's create a POI using the request resource/update_poi:
<your_wialon_pro_address>/ajax.html?svc=resource/update_poi& params={ "itemId":8, "id":0, "callMode":"create", "n":"gurtam", "d":"poi", "y":53.91069937030936, "x":27.516643322771575, "r":100, "f":1, "c":16733440 }&ssid=<your_sid>
Response:
[1, { "id": 1, "n": "gurtam", "y": 53.9106993703, "x": 27.5166433228, "t": 0, "i": 6515, "e": 16516 }]
Now let's change the name and radius of the new POI:
<your_wialon_pro_address>/ajax.html?svc=resource/update_poi& params={ "itemId":8, "id":1, "callMode":"update", "n":"gurtam_office", /* меняем "gurtam" на "gurtam_office" */ "d":"poi", "y":53.91069937030936, "x":27.516643322771575, "r":50, /* меняем 100 на 50 */ "f":1, "c":16733440 }&ssid=<your_sid>
Response:
[1, { "id": 1, "n": "gurtam_office", "y": 53.9106993703, "x": 27.5166433228, "t": 0, "i": 6515, "e": 12605 }]
You can check how changes have been applied by making search request.
To delete a POI, use the request update_poi:
<your_wialon_pro_address>/ajax.html?svc=resource/update_poi& params={ "itemId":8, "id":1, "callMode":"delete" }&ssid=<your_sid>
Response:
[1, null]