1

Unit Report and Commands

(14/10/2020 16:17:27 отредактировано farah.aidid)

Тема: Unit Report and Commands

this is my request:
{"reportResourceId":20170575,"reportTemplateId":5,"reportTemplate":null,"reportObjectId":20171323,"reportObjectSecId":0,"interval":{"from":1574697600,"to":1574791199,"flags":16777216}}

path: /wialon/ajax.html?svc=report/exec_report&sid=<sid>



request params is like:

{"reportResourceId":20170575,"reportTemplateId":5,"reportTemplate":null,"reportObjectId":20171323,"reportObjectSecId":0,"interval":{"flags":16777216,"from":1574697600,"to":1574783999},"remoteExec":1,"reportObjectIdList":[]}

but, getting different response.

i am getting
2: "2019-11-25 22:43:07"
3: "2019-11-26 09:13:14"

but in your application getting:

2: "2019-11-26 06:43:07"
3: "2019-11-26 17:13:14"




Another issue i faced getting commands,
unit.getCommands()
this method sometimes returns null sometimes a list of commands .

I am getting user-access as value : 19327369763 (unit.getUserAccess())
and wialon.item.Unit.accessFlag.executeCommands value is: 16777216
so, when checking whether can-execute the command or not, returns false.
so, though i get a list of commands, i cannot execute them,

but when i go to the site from you [/ ] , i can see commands and also can execute them successfully.

I am confused about these issues, just want to know am i making any mistake or not.
please help me about this.

  • Unit Report and Commands
  • Unit Report and Commands
2

Unit Report and Commands

Re: Unit Report and Commands

Hello!

1. Reports results, messages result and other layesr are using UNIX time UTC+0
To get resutls with user's time zone you need to execute request render/set_locale after login
2. To execute commands the value is 16777216 - bit 24 is activated, but for value =  19327369763 the bit 24 is not
Please check the token access ritghts first.

Diana Cheley
Wialon Hosting Expert
Gurtam
3

Unit Report and Commands

Re: Unit Report and Commands

Hi, how can I execute such commands via JavaScript?

I was trying to follow : https://sdk.wialon.com/api/index.html#wialon
this site.

and, for "svc=unit/registry_fuel_filling_event" this, i faced issue:
I saw "registryFuelFillingEvent" in https://sdk.wialon.com/api/index.html#w … tRegistrar
but, when i try to get this method on code or browser console with wialon.item.MUnitEventRegistrar.registryFuelFillingEvent,
then, it says, "noSuchMethod",

can you please help me

4

Unit Report and Commands

Re: Unit Report and Commands

Hello!

you need to apply method registryFuelFillingEvent to element (item) unit.
For example,

var u = wialon.core.Session.getInstance().getItem(itemId); // get unit by id 
u.registryFuelFillingEvent(1575451750, "fill Dec 4", 27.42944, 53.905012, "Prituckogo 79, Minsk",512, 2000, 0, function (code) {  
    if (code) {
        msg(wialon.core.Errors.getErrorText(code));
    } 
});
Diana Cheley
Wialon Hosting Expert
Gurtam
5

Unit Report and Commands

Re: Unit Report and Commands

thank you so much

6

Unit Report and Commands

(14/10/2020 16:17:50 отредактировано farah.aidid)

Re: Unit Report and Commands

Hi, I am getting "Access Denied"

Request params : {"date":1572619983,"volume":2,"cost":4.36,"location":"Kampung Lakota, Jeli","deviation":30,"x":0,"y":0,"description":"Fuel filling of 0 l to the amount of 0 was made.","itemId":20022689}

7

Unit Report and Commands

Re: Unit Report and Commands

Hi farah.aidid

please check access rights (flags) via token

Diana Cheley
Wialon Hosting Expert
Gurtam
8

Unit Report and Commands

Re: Unit Report and Commands

Hi, when i am registering fuel event with registryFuelFillingEvent

i am sending time for example 15:30
but it is registered as 17:30

before sending i am also using :  customRenderer.setLocale(wialon.util.DateTime.getTimezone(),"en",{flags:256,formatDate:"%Y-%m-%E %H:%M:%S"}, (code) => {

9

Unit Report and Commands

Re: Unit Report and Commands

farah.aidid пишет:

Report

Hi!

via JS you need to register event in UTC+0 (unix time) if then the result will be viewed in Wialon - for example, in reports or on web part the result will be viewed depend on current user's timezone

Diana Cheley
Wialon Hosting Expert
Gurtam
10

Unit Report and Commands

Re: Unit Report and Commands

Hi,
I am a newbie in this platform. I am developing an API using Python which I intend to use mostly to run reports.

To execute a report, I need some parameters such as:
reportResourceId
reportTemplateId
reportObjectId
reportObjectIdList

Where can I get these parameters from?

Kindly assist.

Thank you

11

Unit Report and Commands

Re: Unit Report and Commands

pnbidali пишет:

Hi,
I am a newbie in this platform. I am developing an API using Python which I intend to use mostly to run reports.

To execute a report, I need some parameters such as:
reportResourceId
reportTemplateId
reportObjectId
reportObjectIdList

Where can I get these parameters from?

Kindly assist.

Thank you

Hello, in order to get internal ID of any item created in Wialon you can use core/search_items request.

For example, to get a reportResourceId and reportTemplateId you can execute this request for the "avl_resource" with the specific flags value.
e.g. https://hst-api.wialon.com/wialon/ajax.html?svc=core/search_items&params={"spec":{"itemsType":"avl_resource","propName":"sys_name","propValueMask":"*","sortType":"sys_name"},"force":1,"flags":8193,"from":0,"to":0}&sid=ACTIVE_SID

The response contains resources IDs and related report templates.

Please, check following tutorial regarding search items request -- https://www.youtube.com/watch?v=z9Ro3kp5aqo

Here you can find other video tutorials regarding Wialon API -- https://forum.wialon.com/viewtopic.php?id=18252

Anton Zinovyev
Technical Care Engineer (L2)
Wialon
12

Unit Report and Commands

Re: Unit Report and Commands

Thank you so much, Anton. I was able to retrieve the data.