Differences

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

Link to this comparison view

en:local:remoteapi1504:apiref:messages:get_messages [18/03/2015 14:29] (current)
Line 1: Line 1:
 +====== Get messages ======
  
 +To get messages from the message loader, use the command **messages/​get_messages**: ​
 +<code javascript>​
 +svc=messages/​get_messages&​params={"​indexFrom":<​uint>,​
 +   "​indexTo":<​uint>,​
 +   "​timeFrom:"<​uint>,​
 +   "​timeTo":<​uint>,​
 +   "​filter":<​text>,​
 +   "​flags":<​uint>,​
 +   "​flagsMask":<​uint>,​
 +   "​loadCount":<​uint>​}
 +</​code>​
 +
 +:!: You can find an example of this request in the sample [[../​../​codesamples/​messages]].
 +
 +===== Parameters =====
 +^ Name ^ Description ^
 +| indexFrom | index of the first message requested |
 +| indexTo | index of the last message requested |
 +| timeFrom | interval beginning |
 +| timeTo | interval end |
 +| filter | filter, search in "​pos"​ and "​p"​|
 +| flags | flags for loading messages (see below) |
 +| flagsMask | mask (see below) |
 +| loadCount | how many messages to return (0xffffffff - all found) |
 +:!: Method logic extended: you can use both old **indexFrom/​indexTo** logic and new ones:\\
 +- **timeFrom/​timeTo** (we define message time to start and end);\\
 +- **timeFrom/​loadCount** (we define message time to start, it will display loadCount number of last messages);​\\
 +- **timeTo/​loadCount** (we define message time to end , it will display loadCount number of last messages).\\
 +"​Filter"​ option can be used for any logic. Search is available in "​pos"​ and "​p"​ params. Even if there is no params under search in messages then all messages will be shown with minimal info like ("​t","​f","​tp","​i","​o"​).
 +
 +Response example (no filtering):
 +<code javascript>​
 +{
 + "​count":​ 1,
 + "​messages":​ [{
 + "​t":​ 1426233861,
 + "​f":​ 7,
 + "​tp":​ "​ud",​
 + "​pos":​ {
 + "​y":​ 53.84541,
 + "​x":​ 27.4470783333,​
 + "​z":​ 0,
 + "​s":​ 25,
 + "​c":​ 285,
 + "​sc":​ 255
 + },
 + "​i":​ 0,
 + "​o":​ 0,
 + "​p":​ {
 + "​adc1":​ 0,
 + "​pre2":​ 123,
 + "​param":​ 24,
 + "​param5":​ 43
 + }
 + }]
 +}
 +</​code>​
 +Filter example:
 +<code javascript>​
 +"​filter":"​pos.x,​p.pre*,​p.param?"​
 +</​code>​
 +
 +Filtered response:
 +<code javascript>​
 +{
 + "​count":​ 1,
 + "​messages":​ [{
 + "​t":​ 1426233861,
 + "​f":​ 7,
 + "​tp":​ "​ud",​
 + "​pos":​ {
 + "​x":​ 27.4470783333
 + },
 + "​i":​ 0,
 + "​o":​ 0,
 + "​p":​ {
 + "​pre2":​ 123,
 + "​param5":​ 43
 + }
 + }]
 +}
 +</​code>​
 +After filtering we see pos.x value, values for parameters in pos-object with leading "​pre"​ names, values for parameters in pos-object with leading "​param"​ and one-more-following-symbol names (for example '​param1'​ but '​param'​ is invalid for search).
 +Number of defined parameters using comma as delimiter is unlimited. * -- wildcard for 0 or more symbols, ? - wildcard for exactly one symbol.
 +
 +===== Response =====
 +<code javascript>​
 +{
 + "​count":​ <​uint>,​
 + "​messages":​ [ /* message array */
 + { ... }, /* message */
 + { ... } /* message */
 + ]
 +}
 +</​code>​
 +
 +You can find message formats in the chapter [[../​format/​messages | Data format: Messages]].
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2020 Gurtam