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 [29/11/2013 13:31] (current) |
{{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& |
"f":1, | "f":1, |
"c":16733440 | "c":16733440 |
}&sid=<your_sid> | }&ssid=<your_sid> |
</code> | </code> |
Результат выполнения: | Response: |
<code javascript> | <code javascript> |
[1, { | [1, { |
</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& |
"f":1, | "f":1, |
"c":16733440 | "c":16733440 |
}&sid=<your_sid> | }&ssid=<your_sid> |
</code> | </code> |
Результат выполнения: | Response: |
<code javascript> | <code javascript> |
[1, { | [1, { |
</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& |
"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> |