51

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello!

By default report result has UTC+0 timezone.
To apply user's timezone to report result, after login it needs to execute request  render/set_locale
Then you can execute reports, get PDF file.

For example, timezone +5.30 = "tzOffset":134237528
"tzOffset" value includes DST settings (no DST = 0x08000000 = 134217728 )

https://hst-api.wialon.com/wialon/ajax.html?svc=render/set_locale&sid=02b93b7a37e3ce1510908253b4db8902
params: {"tzOffset":134237528,"language":"en","flags":256,"formatDate":"%m-%E-%Y %H:%M:%S"}

Note: also it may need to url-encode special symbol %

Diana Cheley
Wialon Hosting Expert
Gurtam
52

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Diana пишет:

Hello!

By default report result has UTC+0 timezone.
To apply user's timezone to report result, after login it needs to execute request  render/set_locale
Then you can execute reports, get PDF file.

For example, timezone +5.30 = "tzOffset":134237528
"tzOffset" value includes DST settings (no DST = 0x08000000 = 134217728 )

https://hst-api.wialon.com/wialon/ajax.html?svc=render/set_locale&sid=02b93b7a37e3ce1510908253b4db8902
params: {"tzOffset":134237528,"language":"en","flags":256,"formatDate":"%m-%E-%Y %H:%M:%S"}

Note: also it may need to url-encode special symbol %

thanks for the response,

Here if the customer location is in Saudi Arabia and maybe a different location then do we need to update each time different time zone

53

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello!

How to execute a command for different requests

With search_item API we got different command and each command have different execution, on which flag we set a condition to user selection

core/search_item&params={"id":29916,"flags":512}


{
    "item": {
        "cmds": [
            {
                "n": "إطفاء المحرك",
                "a": 1,
                "t": "tcp,gsm,vrt",
                "c": "custom_msg",
                "p": "Out 1,0"
            },
            {
                "n": "تشغيل المحرك",
                "a": 1,
                "t": "tcp,gsm,vrt",
                "c": "custom_msg",
                "p": "Out 1,1"
            },
            {
                "n": "Arnavi 2",
                "a": 1,
                "t": "tcp,gsm,vrt",
                "c": "custom_msg",
                "p": ""
            },
            {
                "n": "إعادة تشغيل الجهاز",
                "a": 1,
                "t": "tcp,gsm,vrt",
                "c": "custom_msg",
                "p": "reset"
            }
        ]
    },
    "flags": 512
}

1) Sent message option to execute a command
2) Reset option to execute the command
3) simple Execute commands

How i can differenciate this response value of t,c and p for different units,

svc=unit/exec_cmd&params={"itemId":55873,"commandName":"custom_msg","linkType":"tcp,gsm,vrt","param":"","timeout":10,"flags":0}
  • How to get Unit Last update date and time
54

How to get Unit Last update date and time

(01/01/2021 14:39:02 отредактировано trushal.shah)

Re: How to get Unit Last update date and time

Diana пишет:
trushal.shah пишет:

Thanks for the solutions,

Last point that how I can get the movement of the units with start and [Between each] endpoint the day, or between dates

Hello!

To get history data of events (trips, ignition) you need to execute  events/load & events/get
First you load events for some period  - , then get  it
For example,

Get trips from Oct 1 - Oct 5 , unix time UTC+0

Load events

https://hst-api.wialon.com/wialon/ajax.html?svc=events/load&params={"ivalType":1,"itemId":214,"timeFrom":1601510400,"timeTo":1601942399,"detectors":[{"type":"trips","filter1":0}]}&sid=028384ac3f02f18c414208758685b320

Get result

https://hst-api.wialon.com/wialon/ajax.html?svc=events/get&params={"selector":{"type":"trips","timeFrom":1601510400,"timeTo":1601942399,"detalization":3}}&sid=028384ac3f028758685b320

Hello

Thanks for your support,

if you can please support us for below query

Event Load:
{"ivalType":1,"itemId":54533,"timeFrom":1609007400,"timeTo":1609093799,"detectors":[{"type":"trips","filter1":0},{"type":"ignition","filter1":0}]}

Get Event

svc=events/get&params={"selector":{"type":"*","timeFrom":1609007400,"timeTo":1609093799,"detalization":11}}

Here how we can get stop details of the unit movement for track pages

please check the screenshot, we need to display the same stop icon on the map

  • How to get Unit Last update date and time
55

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello!

The Stops are the part of trips where speed is less than min value speed in Trip Detector. So if you need stops intervals you can request events trips with selected speed (custom intervals expressions)

For example, the min speed value = 1 km/h, so "expr":"trips{s<1}" means intervals where speed (s) less than 1 km/h

First load trips

https://hst-api.wialon.com/wialon/ajax.html?svc=events/load&params={"ivalType":1,"itemId":21728414,"timeFrom":1609718400,"timeTo":1609804799,"detectors":[{"type":"trips","filter1":0}]}&sid=02b93b7a37e3ce1510908253b4db8902

Then request intervals with speed < 1 km/h


https://hst-api.wialon.com/wialon/ajax.html?svc=events/get&params={"selector":{"expr":"trips{s<1}","timeFrom":1609718400,"timeTo":1609804799,"detalization":1}}&sid=02b93b7a37e3ce1510908253b4db8902

Response

{"trips":{"0":[{"from":{"t":1609753417,"y":43.3473701477,"x":-8.48857975006},"to":{"t":1609753448,"y":43.2673683167,"x":-8.48857975006},"m":0,"f":0},{"from":{"t":1609753490,"y":43.2673683167,"x":-6.4885802269},"to":{"t":1609753530,"y":43.1673698425,"x":-6.34601783752},"m":0,"f":0},{"from":{"t":1609754439,"y":42.4268341064,"x":-8.6491394043},"to":{"t":1609754439,"y":42.4268341064,"x":-8.6491394043},"m":0,"f":0}]}}
Diana Cheley
Wialon Hosting Expert
Gurtam
56

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Diana пишет:

Hello!

The Stops are the part of trips where speed is less than min value speed in Trip Detector. So if you need stops intervals you can request events trips with selected speed (custom intervals expressions)

For example, the min speed value = 1 km/h, so "expr":"trips{s<1}" means intervals where speed (s) less than 1 km/h

First load trips

https://hst-api.wialon.com/wialon/ajax.html?svc=events/load&params={"ivalType":1,"itemId":21728414,"timeFrom":1609718400,"timeTo":1609804799,"detectors":[{"type":"trips","filter1":0}]}&sid=02b93b7a37e3ce1510908253b4db8902

Then request intervals with speed < 1 km/h


https://hst-api.wialon.com/wialon/ajax.html?svc=events/get&params={"selector":{"expr":"trips{s<1}","timeFrom":1609718400,"timeTo":1609804799,"detalization":1}}&sid=02b93b7a37e3ce1510908253b4db8902

Response

{"trips":{"0":[{"from":{"t":1609753417,"y":43.3473701477,"x":-8.48857975006},"to":{"t":1609753448,"y":43.2673683167,"x":-8.48857975006},"m":0,"f":0},{"from":{"t":1609753490,"y":43.2673683167,"x":-6.4885802269},"to":{"t":1609753530,"y":43.1673698425,"x":-6.34601783752},"m":0,"f":0},{"from":{"t":1609754439,"y":42.4268341064,"x":-8.6491394043},"to":{"t":1609754439,"y":42.4268341064,"x":-8.6491394043},"m":0,"f":0}]}}


Hi, thanks for the reply

we got the response trips{s<1} with this condition but same time we need trips data also

so how I can get all movement of the vehicle with stop, parking, and  trips in single response

57

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello!

There is not parking intervals in response.
You can get only trips, and trips with less speed (stops).
The parkings are calculated as difference between trips time.

First load, then get all full trips, and then get trips intervals (with speed less) as stops.

https://hst-api.wialon.com/wialon/ajax.html?svc=events/load&params={"ivalType":1,"itemId":21728414,"timeFrom":1609718400,"timeTo":1609891199,"detectors":[{"type":"trips","filter1":0}]}&sid=026499c89bc755056c401314b35bfa9f
https://hst-api.wialon.com/wialon/ajax.html?svc=events/get&params={"selector":{"type":"trips","timeFrom":1609718400,"timeTo":1609891199,"detalization":1}}&sid=026499c89bc755056c401314b35bfa9f
https://hst-api.wialon.com/wialon/ajax.html?svc=events/get&params={"selector":{"expr":"trips{s<1}","timeFrom":1609718400,"timeTo":1609891199,"detalization":1}}&sid=026499c89bc755056c401314b35bfa9f

All 3 requests can be execute at one svc=core/batch

Format like
https://hst-api.wialon.com/wialon/ajax.html?svc=core/batch&sid=026499c89bc755056c401314b35bfa9f&params={"params":[{},{},{}]}
where JSON object in array is a request {"svc":"...","params":{...}}

Example

https://hst-api.wialon.com/wialon/ajax.html?svc=core/batch&sid=026499c89bc755056c401314b35bfa9f&params={"params":[{"svc":"events/load","params":{"ivalType":1,"itemId":21728414,"timeFrom":1609718400,"timeTo":1609891199,"detectors":[{"type":"trips","filter1":0}]}},{"svc":"events/get","params":{"selector":{"type":"trips","timeFrom":1609718400,"timeTo":1609891199,"detalization":1}}},{"svc":"events/get","params":{"selector":{"expr":"trips{s<1}","timeFrom":1609718400,"timeTo":1609891199,"detalization":1}}}],"flags":0}

The response will contain full trips (in example 5 full trips) and stops intervals (in example 6 intervals)

[{"events":{"trips":{"0":5}},"states":{"trips":{"updateTime":1606694400}},"selector":{}},{"trips":{"0":[{"from":{"t":1609740136,"y":46.8365631104,"x":-2.789290905},"to":{"t":1609740381,"y":46.3055648804,"x":-2.789290905},"m":1609740681,"f":2},{"from":{"t":1609747691,"y":46.3055648804,"x":-2.789290905},"to":{"t":1609748071,"y":43.3003921509,"x":-2.0059273243},"m":1609748385,"f":2},{"from":{"t":1609748558,"y":43.3003921509,"x":-2.0059273243},"to":{"t":1609748851,"y":43.4693832397,"x":-3.83861064911},"m":1609749180,"f":2},{"from":{"t":1609749642,"y":43.4693832397,"x":-3.83861064911},"to":{"t":1609750584,"y":43.3473701477,"x":-8.48857975006},"m":1609750884,"f":2},{"from":{"t":1609753417,"y":43.3473701477,"x":-8.48857975006},"to":{"t":1609754439,"y":42.4268341064,"x":-8.6491394043},"m":1609754768,"f":2}]}},{"trips":{"0":[{"from":{"t":1609740321,"y":46.3055648804,"x":-2.789290905},"to":{"t":1609740351,"y":46.3055648804,"x":-2.789290905},"m":0,"f":0},{"from":{"t":1609747781,"y":46.2055625916,"x":-2.98929095268},"to":{"t":1609747981,"y":43.3233222961,"x":-2.00242733955},"m":0,"f":0},{"from":{"t":1609748041,"y":43.3003921509,"x":-2.0059273243},"to":{"t":1609748041,"y":43.3003921509,"x":-2.0059273243},"m":0,"f":0},{"from":{"t":1609748588,"y":43.3103904724,"x":-2.0059273243},"to":{"t":1609748822,"y":43.4533843994,"x":-3.83861064911},"m":0,"f":0},{"from":{"t":1609750500,"y":43.3473701477,"x":-8.40155792236},"to":{"t":1609750500,"y":43.3473701477,"x":-8.40155792236},"m":0,"f":0},{"from":{"t":1609753595,"y":42.4268341064,"x":-8.6491394043},"to":{"t":1609754408,"y":42.4268341064,"x":-8.6491394043},"m":0,"f":0}]}}]

If you need to load trips from new interval, you need to execute request svc=events/unload, then load new intervals.

Diana Cheley
Wialon Hosting Expert
Gurtam
58

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Diana пишет:

Hello!

There is not parking intervals in response.
You can get only trips, and trips with less speed (stops).
The parkings are calculated as difference between trips time.

First load, then get all full trips, and then get trips intervals (with speed less) as stops.

https://hst-api.wialon.com/wialon/ajax.html?svc=events/load&params={"ivalType":1,"itemId":21728414,"timeFrom":1609718400,"timeTo":1609891199,"detectors":[{"type":"trips","filter1":0}]}&sid=026499c89bc755056c401314b35bfa9f
https://hst-api.wialon.com/wialon/ajax.html?svc=events/get&params={"selector":{"type":"trips","timeFrom":1609718400,"timeTo":1609891199,"detalization":1}}&sid=026499c89bc755056c401314b35bfa9f
https://hst-api.wialon.com/wialon/ajax.html?svc=events/get&params={"selector":{"expr":"trips{s<1}","timeFrom":1609718400,"timeTo":1609891199,"detalization":1}}&sid=026499c89bc755056c401314b35bfa9f

All 3 requests can be execute at one svc=core/batch

Format like
https://hst-api.wialon.com/wialon/ajax.html?svc=core/batch&sid=026499c89bc755056c401314b35bfa9f&params={"params":[{},{},{}]}
where JSON object in array is a request {"svc":"...","params":{...}}

Example

https://hst-api.wialon.com/wialon/ajax.html?svc=core/batch&sid=026499c89bc755056c401314b35bfa9f&params={"params":[{"svc":"events/load","params":{"ivalType":1,"itemId":21728414,"timeFrom":1609718400,"timeTo":1609891199,"detectors":[{"type":"trips","filter1":0}]}},{"svc":"events/get","params":{"selector":{"type":"trips","timeFrom":1609718400,"timeTo":1609891199,"detalization":1}}},{"svc":"events/get","params":{"selector":{"expr":"trips{s<1}","timeFrom":1609718400,"timeTo":1609891199,"detalization":1}}}],"flags":0}

The response will contain full trips (in example 5 full trips) and stops intervals (in example 6 intervals)

[{"events":{"trips":{"0":5}},"states":{"trips":{"updateTime":1606694400}},"selector":{}},{"trips":{"0":[{"from":{"t":1609740136,"y":46.8365631104,"x":-2.789290905},"to":{"t":1609740381,"y":46.3055648804,"x":-2.789290905},"m":1609740681,"f":2},{"from":{"t":1609747691,"y":46.3055648804,"x":-2.789290905},"to":{"t":1609748071,"y":43.3003921509,"x":-2.0059273243},"m":1609748385,"f":2},{"from":{"t":1609748558,"y":43.3003921509,"x":-2.0059273243},"to":{"t":1609748851,"y":43.4693832397,"x":-3.83861064911},"m":1609749180,"f":2},{"from":{"t":1609749642,"y":43.4693832397,"x":-3.83861064911},"to":{"t":1609750584,"y":43.3473701477,"x":-8.48857975006},"m":1609750884,"f":2},{"from":{"t":1609753417,"y":43.3473701477,"x":-8.48857975006},"to":{"t":1609754439,"y":42.4268341064,"x":-8.6491394043},"m":1609754768,"f":2}]}},{"trips":{"0":[{"from":{"t":1609740321,"y":46.3055648804,"x":-2.789290905},"to":{"t":1609740351,"y":46.3055648804,"x":-2.789290905},"m":0,"f":0},{"from":{"t":1609747781,"y":46.2055625916,"x":-2.98929095268},"to":{"t":1609747981,"y":43.3233222961,"x":-2.00242733955},"m":0,"f":0},{"from":{"t":1609748041,"y":43.3003921509,"x":-2.0059273243},"to":{"t":1609748041,"y":43.3003921509,"x":-2.0059273243},"m":0,"f":0},{"from":{"t":1609748588,"y":43.3103904724,"x":-2.0059273243},"to":{"t":1609748822,"y":43.4533843994,"x":-3.83861064911},"m":0,"f":0},{"from":{"t":1609750500,"y":43.3473701477,"x":-8.40155792236},"to":{"t":1609750500,"y":43.3473701477,"x":-8.40155792236},"m":0,"f":0},{"from":{"t":1609753595,"y":42.4268341064,"x":-8.6491394043},"to":{"t":1609754408,"y":42.4268341064,"x":-8.6491394043},"m":0,"f":0}]}}]

If you need to load trips from new interval, you need to execute request svc=events/unload, then load new intervals.

Hi, thanks for the reply this works

but still, there is wrong location data on the map of the parking and stop comparing with webpenal

All data under s>1 consider as stop with less than 5 min different

As we compare with backend penal and mobile few locations consider as parking is considered as stop in the mobile.

1)i have attached a file of the response

2) screenshot of the web model with stop and parking

3) Mobile same request data with stop and parking

which condition would make can get same stop and parking location as web track on the map

  • How to get Unit Last update date and time
  • How to get Unit Last update date and time
Опубликовать вложения

Иконка вложений Platinum till 6pm.docx 14.81 Кб, файл был скачан 188 раз(а) 

59

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello, trushal.shah

There are used different algorithms (Real-time Data Processing vs Processing Messages from the Database upon Request)  to proceed data via events (for example, Wialon mobile app) and Tracks on web site,
More about it here https://docs.wialon.com/en/hosting/user/data/data.  The results depends on the unit data - how it sends, what parameters and etc.

Unfortunately, it's hard to understand what's wrong on screenshot. Please provide a full request which you execute to get trips / stops data and a real location with time intervals of stops for unit.

Diana Cheley
Wialon Hosting Expert
Gurtam
60

How to get Unit Last update date and time

(12/01/2021 16:09:09 отредактировано trushal.shah)

Re: How to get Unit Last update date and time

Diana пишет:

Hello, trushal.shah

There are used different algorithms (Real-time Data Processing vs Processing Messages from the Database upon Request)  to proceed data via events (for example, Wialon mobile app) and Tracks on web site,
More about it here https://docs.wialon.com/en/hosting/user/data/data.  The results depends on the unit data - how it sends, what parameters and etc.

Unfortunately, it's hard to understand what's wrong on screenshot. Please provide a full request which you execute to get trips / stops data and a real location with time intervals of stops for unit.

Hello

thanks for the reply,

Sure i will do share more details with API call, response and mobile view with webview

In the share screenshots different is that

all location which we get as stop in the API are considered as Parking in the web,

so just want to know how we can get parking data stop data from the API

do we need to add any type like ignition?

61

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

When data are get via events(or in reports proceeded), there is not parking or stops events type, only trips (motion) detected by unit Trip Detector
The parkings/stops system is calculated additionally (you cannot get them via some API) :

The parkings are intervals between trips
For example   1st trip - 10:20 - 11:20
2nd trip  11:50 - 12:30
So the parking is 11:20 - 11:50

The stops are intervals inside trips where the speed is less then value Min moving speed.
For example, 1st trips - 10:20 - 11:20  where speed is less than 1 km/h (default value Min moving speed)  in messages from 10:21 till 10:24, so 3 minutes is stop.

Diana Cheley
Wialon Hosting Expert
Gurtam
62

How to get Unit Last update date and time

(22/01/2021 10:15:47 отредактировано trushal.shah)

Re: How to get Unit Last update date and time

Hello

I do send this message to get track data of the unit same as wialon page

same as the first image and the second image

but we are struggling to get data. we applied the same login you suggest getting between time data

its not sufficient to get the same data as the web does we if we apply s<1 then we are getting all the stops which are not there in the website

below is API call we done


APi URL:

Dates select 11/01/2021 to 12/01/2021 and unit id as 11489

http://gps.tawasolmap.com/wialon/ajax.html?svc=core/batch&sid=bdfabd36adfb22323b0a292ceb799ed5&params={"params":[{"svc":"events/load","params":{"ivalType":1,"itemId":11489,"timeFrom":1609439400,"timeTo":1609525799,"detectors":[{"type":"trips","filter1":0},{"type":"ignition","filter1":0}]}},{"svc":"events/get","params":{"selector":{"type":"trips","timeFrom":1609439400,"timeTo":1609525799,"detalization":11}}},{"svc":"events/get","params":{"selector":{"expr":"trips{s<1}","timeFrom":1609439400,"timeTo":1609525799,"detalization":11}}}],"flags":0}

let me know token required

and also I have attached result we from API call

check attached images that we need same stop and parking would display as wialon web/track page has

Please help me with this would much appreciate

  • How to get Unit Last update date and time
Опубликовать вложения

Иконка вложений Platinum till 6pm.docx 14.81 Кб, файл был скачан 242 раз(а) 

63

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello!

The same different time interval in request  and on screenshot.
"timeFrom":1609439400,"timeTo":1609525799 :
Thu, 31 Dec 2020 18:30:00 +0000
Fri, 01 Jan 2021 18:29:59 +0000 

On screenshot Jan 6, 00:00-18:00 (regarding users timezone).

You write about other dates Dates select 11/01/2021 to 12/01/2021

Sure you can get different result on different intervals.

You can open Developer Console and look which time(from/to) is passed in request to get track data.

Diana Cheley
Wialon Hosting Expert
Gurtam
64

How to get Unit Last update date and time

(01/02/2021 16:05:20 отредактировано trushal.shah)

Re: How to get Unit Last update date and time

Hello

if you can please help me that what would be the format of the URL to send push notification on engine On and Off


{
    "t":"push_messages",    /* action type */
    "p":{
        "url":<text>,        /* server name (port may be defined), start it with "http(s)" */
        "get":<bool>        /* request type: 1 - GET, 0 - POST */       
    }
}

this is what I have set but not getting a notification
https://localhost.ip/front/api/v1/send_push?user=username&msg='Hello'

Do we need to attache message to send push, ot Wialon server would send same which we had set on the text

65

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

trushal.shah пишет:

Hello

if you can please help me that what would be the format of the URL to send push notification on engine On and Off


{
    "t":"push_messages",    /* action type */
    "p":{
        "url":<text>,        /* server name (port may be defined), start it with "http(s)" */
        "get":<bool>        /* request type: 1 - GET, 0 - POST */       
    }
}

this is what I have set but not getting a notification
https://localhost.ip/front/api/v1/send_push?user=username&msg='Hello'

Do we need to attach a message to send push, to Wialon server would send the same which we had set on the text


Hello Diana

if you can please help me in this its working with fire notification from firebase with the below URL

https://serverURL/front/api/v1/send_push?user=brainvire1

Method:  GET

But I am not getting from penal which saws fire of few notifications

66

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

trushal.shah пишет:

Hello

if you can please help me that what would be the format of the URL to send push notification on engine On and Off


{
    "t":"push_messages",    /* action type */
    "p":{
        "url":<text>,        /* server name (port may be defined), start it with "http(s)" */
        "get":<bool>        /* request type: 1 - GET, 0 - POST */       
    }
}

this is what I have set but not getting a notification
https://localhost.ip/front/api/v1/send_push?user=username&msg='Hello'

Do we need to attache message to send push, ot Wialon server would send same which we had set on the text

Hello!

The URL for server is specified path with end point by which the GET/POST request from Wialon will be proceeded.
For example , at my server there is file php which proceeds GET request with some parameters , so at notification as URL I have specified the path to this file.
{t: "push_messages", p: {get: "1", url: "http://dinacheley.com/notif/index.php"}}
The parameters for GET/POST request are specified in notification text  as param1=some_value&param2=%some_wialon_tag%&.....
The parameters name/value  can be different.

Diana Cheley
Wialon Hosting Expert
Gurtam
67

How to get Unit Last update date and time

(10/02/2021 08:59:28 отредактировано trushal.shah)

Re: How to get Unit Last update date and time

Hi, thanks for the replay this working fine, and we are getting notifications

But if I set the URL as this then getting as attached screenshot notification

https://localhost/front/api/v1/send_push?user=brainvire&msg=%UNIT%

and our requirement is to send message same

%UNIT% violated speed limitations. At %POS_TIME% it moved with speed %SPEED% near '%LOCATION%'.

How I can set this if you can please guide me

  • How to get Unit Last update date and time
68

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hi!

If you need to get  a full string as text messages,  you can specify at notification (notification's text)  parameter with JSON object
For example,  msg={"spec":"%UNIT% unit and so on %some_other_wialon_tags%"}
So server should get parameter 'msg' with JSON value, and parse this JSON

Diana Cheley
Wialon Hosting Expert
Gurtam
69

How to get Unit Last update date and time

(18/02/2021 14:08:55 отредактировано trushal.shah)

Re: How to get Unit Last update date and time

Diana пишет:

Hi!

If you need to get  a full string as text messages,  you can specify at notification (notification's text)  parameter with JSON object
For example,  msg={"spec":"%UNIT% unit and so on %some_other_wialon_tags%"}
So server should get parameter 'msg' with JSON value, and parse this JSON


Thanks for the update

the issue is with Notification text with space is not working

"txt":"Helllo UNITName%UNIT%Current_Location: %LOCATION%Current_Time%CURR_TIME%"


Notification got just Hello text rest of the message skip due to space, if we have remove all space then its working

like this "txt":"HellloUNITName%UNIT%Current_Location:%LOCATION%Current_Time%CURR_TIME%"

check the attached screenshot

  • How to get Unit Last update date and time
  • How to get Unit Last update date and time
70

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

trushal.shah пишет:
Diana пишет:

Hi!

If you need to get  a full string as text messages,  you can specify at notification (notification's text)  parameter with JSON object
For example,  msg={"spec":"%UNIT% unit and so on %some_other_wialon_tags%"}
So server should get parameter 'msg' with JSON value, and parse this JSON


Thanks for the update

the issue is with Notification text with space is not working

"txt":"Helllo UNITName%UNIT%Current_Location: %LOCATION%Current_Time %CURR_TIME%"


Notification got just Hello text rest of the message skip due to space, if we have remove all space then its working

like this "txt":"HellloUNITName%UNIT%Current_Location:%LOCATION%Current_Time %CURR_TIME%"

check the attached screenshot

Hello!

Try to type  URL-encoding %20  instead space

Diana Cheley
Wialon Hosting Expert
Gurtam
71

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Diana пишет:
trushal.shah пишет:
Diana пишет:

Hi!

If you need to get  a full string as text messages,  you can specify at notification (notification's text)  parameter with JSON object
For example,  msg={"spec":"%UNIT% unit and so on %some_other_wialon_tags%"}
So server should get parameter 'msg' with JSON value, and parse this JSON


Thanks for the update

the issue is with Notification text with space is not working

"txt":"Helllo UNITName%UNIT%Current_Location: %LOCATION%Current_Time %CURR_TIME%"


Notification got just Hello text rest of the message skip due to space, if we have remove all space then its working

like this "txt":"HellloUNITName%UNIT%Current_Location:%LOCATION%Current_Time %CURR_TIME%"

check the attached screenshot

Hello!

Try to type  URL-encoding %20  instead space

thanks for the reply but still looks its skip the notification text with space, even from penal also

txt: UNITName: %UNIT% Current_Location: %LOCATION% Current_Time %CURR_TIME%

encode text: UNITName%20%25UNIT%25%20Current_Location%20%25LOCATION%25%20Current_Time%20%25CURR_TIME%25

But still its skip with space

  • How to get Unit Last update date and time
72

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello!

As I said before, it's better to send text as JSON parameter string type, i.e notification text is like paramName={"spec":"%UNIT% unit and so on %some_other_wialon_tags% some text with spaces"}
Sure the server should parse parameter paramName as JSON

In any case you should look through server parsing which get message from Wialon.
For example, our push server parse  any text from Wialon notifications, and users get the same text on mobile as in web interface.

Diana Cheley
Wialon Hosting Expert
Gurtam
73

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Diana пишет:

Hello!

As I said before, it's better to send text as JSON parameter string type, i.e notification text is like paramName={"spec":"%UNIT% unit and so on %some_other_wialon_tags% some text with spaces"}
Sure the server should parse parameter paramName as JSON

In any case you should look through server parsing which get message from Wialon.
For example, our push server parse  any text from Wialon notifications, and users get the same text on mobile as in web interface.

Thanks for the support

review with both option but getting error

Normal URL

"act":[{"t":"push_messages","p":{"url":"https://tawasoul.brainvire.dev/front/api/v1/send_push?user=brainvire&msg=","get":1}}],"txt":{"spec":"%UNIT%"}



After encode
"act":[{"t":"push_messages","p":{"url":"https%3A%2F%2Ftawasoul.brainvire.dev%2Ffront%2Fapi%2Fv1%2Fsend_push%3Fuser%3Dbrainvire%26msg%3D","get":1}}],"txt":%7B%22spec%22%3A%22%25UNIT%25%7D,



Both case its not working

getting error

    "error": 4,
    "reason": "VALIDATE_PARAMS_ERROR: {n: text, txt: text, ta: uint, td: uint, ma: uint, mmtd: uint, cdt: uint, mast: uint, mpst: uint, cp: uint, fl: uint, tz: int, la: text, un: [long], sch: {f1: ushort, f2: ushort, t1: ushort, t2: ushort, m: uint, y: uint, w: uint}, trg: {t: text, p: {}}, act: [{t: text, p: {}}]}"
}

74

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello!

When you change notification , you need to send all parameters, not only changed.
Also the parameter "txt" value should be string, not object, so it needs ""

For example,

{"n":"dinacheley","ta":1614027600,"td":0,"tz":134228528,"la":"ru","ma":0,"sch":{"f1":0,"f2":0,"t1":0,"t2":0,"m":0,"y":0,"w":0,"fl":0},"ctrl_sch":{"f1":0,"f2":0,"t1":0,"t2":0,"m":0,"y":0,"w":0,"fl":0},"un":[20685653,21728414],"trg":{"t":"outage","p":{"type":"0","time":60,"check_restore":1}},"d":"","act":[{"t":"push_messages","p":{"url":"https://tawasoul.brainvire.dev/front/api/v1/send_push?user=brainvire&msg=","get":1}}],"txt":"{\"spec\":\"%UNIT%\"}","fl":0,"mast":0,"mpst":0,"cdt":0,"mmtd":3600,"cp":0,"id":124,"itemId":930849,"callMode":"update"}

Diana Cheley
Wialon Hosting Expert
Gurtam
75

How to get Unit Last update date and time

Re: How to get Unit Last update date and time

Hello

How I can get running vehicle latest details in the below API

https://sdk.wialon.com/wiki/en/kit/remo … vents/load

like if the vehicle as in the parking then getting proper data of the duration of movement

but if in the running mode then also getting last parked data  not currently running data, if you can help me which flag i should add to get the latest running data with below API

Below post data i am using

{"params":[{"svc":"events\/load","params":{"detectors":[{"filter1":0,"type":"trips"}],"timeTo":1616092199,"ivalType":1,"timeFrom":1616005800,"itemId":65788}},{"svc":"events\/get","params":{"selector":{"detalization":11,"type":"*","timeFrom":1616005800,"timeTo":1616092199}}},{"svc":"events\/get","params":{"selector":{"timeFrom":1616005800,"detalization":11,"expr":"trips{s<1}","timeTo":1616092199}}}],"flags":0}&sid=fd3b1aff8d623662dfdd038effd7ab25