1

Help with executing report with API sdk

Тема: Help with executing report with API sdk

Hi.

We have devloped other functionalities already, like load user, resources, view available units and their icons...but we are having problem with executing report. We have read the documentation and we are making a petition with json like this:
---------------------
?svc=report/exec_report&sid=a6c7f0fff6311fb10db65567b66484e7&params={reportResourceId:418720,ReportTemplateId:1,ReportObjectId:162568,reportObjectSecId:0,interval:{from:1352303759,to:1352323759,flags:0}}
-----------------------------

- where sid is the session id used for login,
- reportResourceId is the id of the resource
- ReportObjectId is the id of the unit (available for that user and account, this is checked)
- ReportObjectSecId: 0 (report about unit, not driver)
- interval has from and to time in UTC, as you can see.

The result is error = 4. (invalid input!)

We have been several hours making tests but we are not detecting where is the error. Could you help us about if there is an error about ids of resource or an error in the petition by json..?

We have also tried to view the example that other user posted a few days ago but it seems we can't achieve it works.

I hope you can help with this.

2

Help with executing report with API sdk

Re: Help with executing report with API sdk

I have sent this request and it has executed successfully.

http://host/wialon/ajax.html?svc=report/exec_report&sid=sid&params={"reportResourceId":id,"reportTemplateId":id,"reportObjectId":id,"reportObjectSecId":0,"interval":{"flags":0,"from":1349726340,"to":1352318459}}

I think that you use incorrect params:

chronique пишет:

,ReportTemplateId:1,ReportObjectId:162568,

reportTemplateId!=ReportTemplateId
reportObjectId!=ReportObjectId

Mobile Development
Gurtam
3

Help with executing report with API sdk

Re: Help with executing report with API sdk

Hi Kopa, thanks for your quickly answer. These points that you comment have been already checked, but it could be possible we are making an error...not sure.

For example, to see what is the reportTemplateId we make a json petition (avl_resource) and we receive this:
Resource is SOPORTE and id is 418720
Report is ACTIVIDAD and its id is 1 (there is only one report for this resource).
Here you have the answer where we achieve this data:

-----------------------------
stdClass Object ( [i] => 418720 [d] => stdClass Object ( [nm] => SOPORTE [cls] => 3 [id] => 418720 [prp] => stdClass Object ( [emails] => ["xxxxxxxxxxxxx"] ) [crt] => 418719 [bact] => 418720 [gd] => beb391349b0b1bf03d2f3424622ab522 [aplt] => stdClass Object ( ) [apltmax] => 0 [aclt] => stdClass Object ( ) [acltmax] => 0 [acltt] => stdClass Object ( ) [aclttmax] => 0 [amch] => stdClass Object ( ) [amchmax] => 0 [aequ] => stdClass Object ( ) [aequmax] => 0 [apltg] => stdClass Object ( ) [apltgmax] => 0 [rep] => stdClass Object ( [1] => stdClass Object ( [id] => 1 [n] => ACTIVIDAD [ct] => avl_unit [c] => 58128 ) ) [repmax] => 0 [drvrs] => stdClass Object ( ) [drvrsmax] => 0 [unf] => stdClass Object ( [1] => stdClass Object ( [id] => 1 [n] => CONTROL_GPS_N1 [ta] => 1339711200 [td] => 1561845599 [ma] => 0 [fl] => 0 [ac] => 633 [un] => Array ( [0] => 167742 [1] => 218562 [2] => 167744 [3] => 167743 [4] => 167745 [5] => 218964 [6] => 230933 [7] => 230928 [8] => 230932 [9] => 230931 [10] => 229804 ) [act] => Array ( [0] => email [1] => message ) [trg] => sensor_value ) [2] => stdClass Object ( [id] => 2 [n] => CONT..................(not all the packet is shown here now, only the important part for this problem).
---------------------------------------

Then, to be sure that the unit is under control of this resource we have checked both options
1) in hosting.gurtam.com we have seen the acces rights from this resource to the unit (and its ok, it has all clicked)
2) making the json petition of units available for that user, and we receive this:

stdClass Object ( [item] => stdClass Object ( [nm] => TOYOTA LAND CRUISER BELEN [cls] => 2 [id] => 162568 [prp] => stdClass Object ( [monitoring_sensor_id] => 1 [sensors_colors_id] => 1 ) [crt] => 148976 [bact] => 148977 [gd] => 17982174a84e9f44c4195e80afca9d90 [uid] => 40104620599 [hw] => 4381 [ph] => [psw] => [pos] => stdClass Object ( [t] => 1352327188 [y] => 41.493358326 [x] => 2.36927833557 [z] => 0 [s] => 0 [c] => 0 [sc] => 0 ) [lmsg] => stdClass Object ( [t] => 1352327188 [f] => 7 [tp] => ud [pos] => stdClass Object ( [y] => 41.493358326 [x] => 2.36927833557 [z] => 0 [s] => 0 [c] => 0 [sc] => 0 .....(not all the answer is shown)

----------------

SO, IT seems it is all okay, but we are not able to see where the error is.
a) Something about acces rights? it would be very strange because that user has all acces
b) Something about bad params ? Not sure, but it seems all is okay and all ids are okay..?¿

Could you please check, with this specific example we made, where is the error. We have been several hours and, where we don't have preivous reports to compare, we can't advance now.

Thanks.

4

Help with executing report with API sdk

Re: Help with executing report with API sdk

Solved!

For all those other user that are having same problem, check the capitals letter. At our case, we have ad "ReportTemplateId" when it is "reportTemplateId"  (please note that "R" and "r" are different.

We have achieved to work with selected user and unit and report, so now it is only a simple problem of "work" with the data received.

You can close this topic.
Thanks for the help.