This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:pro:remoteapi:codesamples:resources [06/03/2013 15:33] 127.0.0.1 external edit |
en:pro:remoteapi:codesamples:resources [17/04/2013 13:41] zuve |
||
---|---|---|---|
Line 1: | Line 1: | ||
{{indexmenu_n>5}} | {{indexmenu_n>5}} | ||
- | ====== Ресурсы ====== | + | ====== Resource ====== |
- | Рассмотрим работу с ресурсами на примере создания, редактирования и удаления POI. Принципы работы с остальными ресурсами (кроме отчетов) аналогичны рассмотренным. | + | 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. |
- | ===== Создание POI ===== | + | 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. |
- | Создадим POI используя запрос [[../apiref/resource/update_poi|resource/update_poi]]: | + | |
+ | ===== Creating POI ===== | ||
+ | Let's create a POI using the request [[../apiref/resource/update_poi|resource/update_poi]]: | ||
<code> | <code> | ||
<your_wialon_pro_address>/ajax.html?svc=resource/update_poi& | <your_wialon_pro_address>/ajax.html?svc=resource/update_poi& | ||
Line 18: | Line 20: | ||
"f":1, | "f":1, | ||
"c":16733440 | "c":16733440 | ||
- | }&sid=<your_sid> | + | }&ssid=<your_sid> |
</code> | </code> | ||
- | Результат выполнения: | + | Response: |
<code javascript> | <code javascript> | ||
[1, { | [1, { | ||
Line 33: | Line 35: | ||
</code> | </code> | ||
- | ===== Редактирование POI ===== | + | ===== Editing POI ===== |
- | Изменим у созданного POI название и радиус: | + | Now let's change the name and radius of the new POI: |
<code> | <code> | ||
<your_wialon_pro_address>/ajax.html?svc=resource/update_poi& | <your_wialon_pro_address>/ajax.html?svc=resource/update_poi& | ||
Line 48: | Line 50: | ||
"f":1, | "f":1, | ||
"c":16733440 | "c":16733440 | ||
- | }&sid=<your_sid> | + | }&ssid=<your_sid> |
</code> | </code> | ||
- | Результат выполнения: | + | Response: |
<code javascript> | <code javascript> | ||
[1, { | [1, { | ||
Line 63: | Line 65: | ||
</code> | </code> | ||
- | Проверить применение изменений можно выполнив [[../apiref/core/search_item|поисковый запрос]]. | + | You can check how changes have been applied by making [[../apiref/core/search_item|search request]]. |
- | ===== Удаление POI ===== | + | ===== Deleting POI ===== |
- | Для удаления POI нужно использовать запрос [[../apiref/resource/update_poi|update_poi]]: | + | To delete a POI, use the request [[../apiref/resource/update_poi|update_poi]]: |
<code> | <code> | ||
<your_wialon_pro_address>/ajax.html?svc=resource/update_poi& | <your_wialon_pro_address>/ajax.html?svc=resource/update_poi& | ||
Line 73: | Line 75: | ||
"id":1, | "id":1, | ||
"callMode":"delete" | "callMode":"delete" | ||
- | }&sid=<your_sid> | + | }&ssid=<your_sid> |
</code> | </code> | ||
- | Результат выполнения: | + | Response: |
<code javascript> | <code javascript> | ||
[1, null] | [1, null] | ||
</code> | </code> |
|