Differences

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

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
en:pro:remoteapi:codesamples:search [06/03/2013 15:33]
127.0.0.1 external edit
en:pro:remoteapi:codesamples:search [17/04/2013 13:40]
zuve
Line 1: Line 1:
 {{indexmenu_n>​2}} {{indexmenu_n>​2}}
-====== ​Поиск элементов ​====== +====== ​Item search ​====== 
-Одними из наиболее часто используемых запросов в Wialon ​являются поисковые запросыВ Wialon ​возможны два вида поиска+One of the most common requests in Wialon ​are search requestsTwo kinds of search are possible in Wialon:  
-  * [[#Поиск элемента по ID]], +  * [[#Search item by ID]], 
-  * [[#Поиск элементов по критериям]]. +  * [[#Search items by property]]
  
  
-===== Поиск элемента по ID ===== +===== Search item by ID ===== 
-Простейшим поиском,​ является поиск по идентификаторуЕсли известен ​ID элемента,​ то можно получить любую доступную информацию о немиспользуя запрос ​[[../​apiref/​core/​search_item|core/​search_item]]. ​В качестве примера найдем объект по известному ​ID. Для того, чтобы в ответе содержалось местоположение объекта нужно установить флаг ​0x00000400, ​также установим флаг ​0x00000001 ​для того, чтобы узнать имя объекта(Подробнее о флагах и форматах данных можно почитать в разделе ​[[../​apiref/​format/​format]].+The search by item ID is the simplest oneIf item ID is knownany available information about this item can be fetched by using the request ​[[../​apiref/​core/​search_item|core/​search_item]]. ​For example, lets find unit by ID. To provide the response with position of a unit the flag 0x00000400 ​must be set. Besideswe will set the flag 0x00000001 ​to get unit nameDetailed information about flags and data formats is given in the chapter ​[[../​apiref/​format/​format]]. ​ 
 <​code>​ <​code>​
 <​your_wialon_pro_address>/​ajax.html?​svc=core/​search_item&​ <​your_wialon_pro_address>/​ajax.html?​svc=core/​search_item&​
Line 13: Line 14:
  "​itemId":​48,​  "​itemId":​48,​
  "​flags":​1025  "​flags":​1025
- }&sid=<​your_sid>​+ }&ssid=<​your_sid>​
 </​code>​ </​code>​
  
-Результат выполнения:+Response:
 <code javascript>​ <code javascript>​
 { {
Line 44: Line 45:
 } }
 </​code>​ </​code>​
 +From the response, we learn that unit with specified ID is called "​Auto001"​ and its last known position is 37.65644 NL and 55.76416 EL.
  
-Из ответа видно что объект с заданным идентификатором называется "​Auto001"​ и последнее известное его местоположение это 37.65644 с.ш. и 55.76416 в.д. 
  
-===== Поиск элементов по критериям ​=====+===== Search items by property ​=====
  
-Рассмотренный выше способ удобно применять когда нам нужно узнать подробную информацию об элементе с известным ​ID. Но зачастую требуется найти несколько элементовудовлетворяющих критериям поиска,​ для этих целей используется запрос ​[[../​apiref/​core/​search_items|core/​search_items]]. ​Напримернайти всех пользователей можно следующим запросом:+Method from the example above is convenient for those cases, when we need to learn more about item with known ID. But often it is needed to find several itemsthat will satisfy search conditions. For this purposes the request ​[[../​apiref/​core/​search_items|core/​search_items]] ​is usedFor exampleall users can be found by making the following request:
  
 <​code>​ <​code>​
Line 64: Line 65:
           "​from":​0,​           "​from":​0,​
           "​to":​0xffffffff           "​to":​0xffffffff
- }&sid=<​your_sid>​+ }&ssid=<​your_sid>​
 </​code>​ </​code>​
-Звездочка в параметре **"propValueMask"** означает,​ что в результирующем массиве будут присутствовать пользователи с любым значением поля **"sys_name"**, а это значит все доступные пользователиЕдиница в параметре **"flags"** означает,​ что только минимальная информация о пользователе попадет в ответ (подробнее о флагах пользователя в разделе ​[[../​apiref/​format/​user]])Значения параметров **"from"** и **"to"**, равные ​и 0xffffffff ​соответственно,​ указывают на точто вернуть следует всех найденных пользователей. +Asterisk in the parameter //propValueMask// means that in the result array there will be users with any values in the field //sys_name// (that is users of any names). It means all available users will be present in the resultValue "1" ​of the parameter //flags// means that basic information about the item must be included in the result. Detailed information about user flags is given in the chapter ​[[../​apiref/​format/​user]]. ​Values of the parameters //from// and //​to// ​ which equals ​to 0 and 0xffffffff ​accordinglyindicate that all found users should be returned.
  
-Результат выполнения:+Response:
 <code javascript>​ <code javascript>​
 { {
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam