1

search items error

Topic: search items error

Dear All,

Our coders run into this, when testing the SDK possibilities for the first time:

request:
https://hst-api.wialon.com/wialon/ajax. … 2013%22%7D

response: {
  "host": "46.107.68.128",
  "eid": "4d0c355f76039a984859aed6839307e8",
  "au": "eflottademo",
  "tm": 1371628555,
  "user": {
    "nm": "eflottademo",
    "cls": 1,
    "id": 156890,
    "prp": {
      "addr_provider": "map_webgis",
      "cfmt": "0",
      "dst": "-1",
      "evt_flags": "2",
      "fpnl": "monitoring",
      "language": "hu",
      "last_tail_points": "50",
      "minimap_zoom_level": "15",
      "mondv": "[\"156891_1\"]",
      "mont": "1",
      "monu": "[\"194822\",\"419681\",\"584670\"]",
      "monuv": "[\"194822\",\"419681\",\"584670\"]",
      "msc": "1",
      "mtg": "1",
      "mtgy": "0",
      "mu_cmd_btn": "0",
      "mu_delete_from_list": "0",
      "mu_events": "0",
      "mu_gps": "1",
      "mu_gps_mode": "0",
      "mu_gps_time": "0",
      "mu_loc_mode": "0",
      "mu_location": "0",
      "mu_move": "1",
      "mu_photo": "0",
      "mu_tracks": "1",
      "mu_tracks_ival": "0",
      "mu_watch": "1",
      "muf": "1027",
      "muow": "584670",
      "poil": "[\"156891_1\"]",
      "radd": "{\"w\":\"4\",\"c\":0,\"u\":419681,\"a\":1,\"td\":1,\"s\":\"default\"}",
      "show_log": "0",
      "tz": "184749584",
      "umap": "Google Streets",
      "umsp": "19.2048823,47.61340164287031,8",
      "ursstp": "0x17bf",
      "us_addr_fmt": "1255211008_10_5",
      "vsplit_block_left_panel": "381.4102478027344",
      "vsplit_monitoring_map_target": "200",
      "vsplit_report_templates_filter_target": "325",
      "znsn": "1"
    },
    "crt": 154093,
    "bact": 156891,
    "fl": 22,
    "hm": "",
    "uacl": 2097795
  },
  "classes": {
    "avl_hw": 4,
    "avl_resource": 3,
    "avl_retranslator": 7,
    "avl_route": 6,
    "avl_unit": 2,
    "avl_unit_group": 5,
    "user": 1
  }
}
request:https://hst-api.wialon.com/wialon/ajax.html?svc=core%2Fsearch_item&sid=4d0c355f76039a984859aed6839307e8&params=%7B%22spec%22%3A%7B%22itemsType%22%3A%22name%22%2C%22propName%22%3A%22sys_name%22%2C%22propValueMask%22%3A%22*%22%2C%22sortType%22%3A%22sys_name%22%7D%2C%22force%22%3A1%2C%22flags%22%3A1%2C%22from%22%3A0%2C%22to%22%3A0%7D



response:

{"error":4}



or:

request:https://hst-api.wialon.com/wialon/ajax.html?svc=core%2Fsearch_item&sid=4d0c355f76039a984859aed6839307e8&params=%7B%22spec%22%3A%7B%22itemsType%22%3A%22name%22%2C%22propName%22%3A%22sys_name%22%2C%22propValueMask%22%3A%22*%22%2C%22sortType%22%3A%22sys_name%22%2C%22propType%22%3A%22list%22%7D%2C%22force%22%3A1%2C%22flags%22%3A1%2C%22from%22%3A0%2C%22to%22%3A0%7D



response:

{"error":4}

Thanks for your help,
Gergely

Eflotta Vehicle Tracking Ltd, Hungary
www.eflotta.com
2

search items error

Re: search items error

Dear Gergely,

your coders are using bad "itemsType" value, it must be one of the following:

avl_hw
avl_resource
avl_retranslator
avl_unit – unit
avl_unit_group
user
avl_route.

3

search items error

Re: search items error

duig wrote:

Dear Gergely,

your coders are using bad "itemsType" value, it must be one of the following:

avl_hw
avl_resource
avl_retranslator
avl_unit – unit
avl_unit_group
user
avl_route.

Dear Igor,

Thanks for your help but no success yet,
The SDK says:

Search items by property
For more complicated searches, the request core/search_items is used. For example, all users can be found by making the following request:https://hst-api.wialon.com/wialon/ajax.html?svc=core/search_items&
        params={
               "spec":{
                      "itemsType":"user",
                       "propName":"sys_name",
                       "propValueMask":"*",
                       "sortType":"sys_name"
               },
                "force":1,
               "flags":1,
               "from":0,
               "to":0
        }&sid=<your_sid>


Nevertheless, the results:

request:https://hst-api.wialon.com/wialon/ajax.html?svc=core%2Flogin&params=%7B%22user%22%3A%22eflottademo%22%2C%22password%22%3A%22demo2013%22%7D
response:{"host":"188.36.241.190","eid":"81f296768b1649abca0ee64c8fe00a89","au":"eflottademo","tm":1371750233,"user":{"nm":"eflottademo","cls":1,"id":156890,"prp":{"addr_provider":"map_webgis","cfmt":"0","dst":"-1","evt_flags":"2","fpnl":"monitoring","language":"hu","last_tail_points":"50","minimap_zoom_level":"15","mondv":"[\"156891_1\"]","mont":"1","monu":"[\"194822\",\"419681\",\"584670\"]","monuv":"[\"194822\",\"419681\",\"584670\"]","msc":"1","mtg":"1","mtgy":"0","mu_cmd_btn":"0","mu_delete_from_list":"0","mu_events":"0","mu_gps":"1","mu_gps_mode":"0","mu_gps_time":"0","mu_loc_mode":"0","mu_location":"0","mu_move":"1","mu_photo":"0","mu_tracks":"1","mu_tracks_ival":"0","mu_watch":"1","muf":"1027","muow":"584670","poil":"[\"156891_1\"]","radd":"{\"w\":\"4\",\"c\":0,\"u\":419681,\"a\":1,\"td\":1,\"s\":\"default\"}","show_log":"0","tz":"184749584","umap":"Google Streets","umsp":"19.2048823,47.61340164287031,8","ursstp":"0x17bf","us_addr_fmt":"1255211008_10_5","vsplit_block_left_panel":"381.4102478027344","vsplit_monitoring_map_target":"200","vsplit_report_templates_filter_target":"325","znsn":"1"},"crt":154093,"bact":156891,"fl":22,"hm":"","uacl":2097795},"classes":{"avl_hw":4,"avl_resource":3,"avl_retranslator":7,"avl_route":6,"avl_unit":2,"avl_unit_group":5,"user":1}}

request:https://hst-api.wialon.com/wialon/ajax.html?svc=core%2Fsearch_item&sid=&params=%7B%22spec%22%3A%7B%22itemsType%22%3A%22user%22%2C%22propName%22%3A%22sys_name%22%2C%22propValueMask%22%3A%22*%22%2C%22sortType%22%3A%22sys_name%22%7D%2C%22force%22%3A1%2C%22flags%22%3A1%2C%22from%22%3A0%2C%22to%22%3A0%7D

response: {"error":4}

Could you please send us an example req/resp from the login to the response with the unit IDs?
Many thanks in advance,
Gergely

Eflotta Vehicle Tracking Ltd, Hungary
www.eflotta.com
4

search items error

Re: search items error

We have some examples at Wialon Development portal.

Eflotta wrote:

Could you please send us an example req/resp from the login to the response with the unit IDs?

Remote API examples include "Login/logout" and "Item search" which you need.

Mobile Development
Gurtam
5

search items error

Re: search items error

As far as I understand, this request is made from your examples. What is the exact problem with it?

Eflotta Vehicle Tracking Ltd, Hungary
www.eflotta.com
6

search items error

Re: search items error

Eflotta
This examples don't have any problems. Search for itemsType="user" returns zero users because user wialon_test doesn't has access to other users. If you change itemsType to avl_unit, you get next response with 15 units.

{"searchSpec":{"itemsType":"avl_unit","propName":"sys_name","propValueMask":"*","sortType":"sys_name","propType":""},"dataFlags":1,"totalItemsCount":15,"indexFrom":0,"indexTo":0,"items":[{"nm":"#RoadKey","cls":2,"id":893061,"uacl":-1},{"nm":"361654","cls":2,"id":880677,"uacl":-1},{"nm":"361654","cls":2,"id":890803,"uacl":-1},{"nm":"ADM100_vologda","cls":2,"id":883606,"uacl":-1},{"nm":"Audi_retr","cls":2,"id":717361,"uacl":545},{"nm":"Bavarian Tractor","cls":2,"id":717359,"uacl":545},{"nm":"F370","cls":2,"id":882423,"uacl":-1},{"nm":"F6627","cls":2,"id":886295,"uacl":-1},{"nm":"FM Blue","cls":2,"id":890493,"uacl":-1},{"nm":"G400","cls":2,"id":883520,"uacl":-1},{"nm":"g400","cls":2,"id":884383,"uacl":-1},{"nm":"sch1","cls":2,"id":887137,"uacl":-1},{"nm":"usk86","cls":2,"id":886321,"uacl":-1},{"nm":"Новый объект","cls":2,"id":891671,"uacl":-1},{"nm":"Т-Хелпер","cls":2,"id":881338,"uacl":-1}]}

Requests:
1. https://hst-api.wialon.com/wialon/ajax.html?svc=core/login&params={"user":"wialon_test","password":"test"}
2. https://hst-api.wialon.com/wialon/ajax.html?svc=core/search_items&params={"spec":{"itemsType":"avl_unit","propName":"sys_name","propValueMask":"*","sortType":"sys_name"},"force":1,"flags":1,"from":0,"to":0}&sid=<your_sid>

Mobile Development
Gurtam