Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:pro:remoteapi:codesamples:resources [06/03/2013 16:04]
zuve
en:pro:remoteapi:codesamples:resources [29/11/2013 13:31]
Line 1: Line 1:
-{{indexmenu_n>​5}} 
-====== Resource ====== 
-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. ​ 
- 
-===== Creating POI ===== 
-Let's create a POI using the request [[../​apiref/​resource/​update_poi|resource/​update_poi]]:​ 
-<​code>​ 
-<​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 
- }&​sid=<​your_sid>​ 
-</​code>​ 
-Response: 
-<code javascript>​ 
-[1, { 
-    "​id":​ 1, 
-    "​n":​ "​gurtam",​ 
-    "​y":​ 53.9106993703,​ 
-    "​x":​ 27.5166433228,​ 
-    "​t":​ 0, 
-    "​i":​ 6515, 
-    "​e":​ 16516 
-}] 
-</​code>​ 
- 
-===== Editing POI ===== 
-Now let's change the name and radius of the new POI: 
-<​code>​ 
-<​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 
- }&​sid=<​your_sid>​ 
-</​code>​ 
-Response: 
-<code javascript>​ 
-[1, { 
-    "​id":​ 1, 
-    "​n":​ "​gurtam_office",​ 
-    "​y":​ 53.9106993703,​ 
-    "​x":​ 27.5166433228,​ 
-    "​t":​ 0, 
-    "​i":​ 6515, 
-    "​e":​ 12605 
-}] 
-</​code>​ 
- 
-You can check how changes have been applied by making [[../​apiref/​core/​search_item|search request]]. 
- 
-===== Deleting POI ===== 
-To delete a POI, use the request [[../​apiref/​resource/​update_poi|update_poi]]:​ 
-<​code>​ 
-<​your_wialon_pro_address>/​ajax.html?​svc=resource/​update_poi&​ 
- params={ 
- "​itemId":​8,​ 
- "​id":​1,​ 
- "​callMode":"​delete"​ 
- }&​sid=<​your_sid>​ 
-</​code>​ 
-Response: 
-<code javascript>​ 
-[1, null] 
-</​code>​ 
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam