1

Executing a report with a "reportTemplate" parameter using Remote API

(09/05/2018 14:33:16 отредактировано sourjah)

Тема: Executing a report with a "reportTemplate" parameter using Remote API

I am trying to execute a report and according to this documentation, I can provide a reportTemplate parameter. I got the data from the reportTempate parameter by executing this query.
Then, from that data I am executing the query below. However, I get { error: 4, reason: 'WRONG_PARAMS' }. Please help me figure out what is wrong with my query.

Note: "reporteResourceId" is the resourceId of the current user, "reportObjectId" is a the ID of an avl_unit. And the whitespaces are only added for better readability (my real query does not contain whitespaces).

 https://hst-api.wialon.com/wialon/ajax.html?svc=report/exec_report&params={
"reportResourceId":13938986,
"reportTemplateId":0,
"reportObjectId":16902145,
"reportObjectSecId":0,
    "interval":{
    "from":1525809600,
    "to":1525895940,
    "flags":0
},
"reportTemplate":{
                "id": 5,
                "n": "RAMIL - Simple Report",
                "ct": "avl_unit",
                "p": "{\"bind\":{\"avl_unit\":[]}}",
                "tbl": [
                    {
                        "n": "unit_stats",
                        "l": "Statistics",
                        "c": "",
                        "cl": "",
                        "cp": "",
                        "s": "[\"address_format\",\"time_format\",\"us_units\"]",
                        "sl": "[\"Address\",\"Time Format\",\"Measure\"]",
                        "p": "{\"address_format\":\"1255211008_10_5\",\"time_format\":\"%Y-%m-%E_%H:%M:%S\",\"us_units\":0}",
                        "sch": {
                            "f1": 0,
                            "f2": 0,
                            "t1": 0,
                            "t2": 0,
                            "m": 0,
                            "y": 0,
                            "w": 0,
                            "fl": 0
                        },
                        "f": 0
                    }
                ]
            }}&sid=061bab3b585d4dccd5c1b66840e90864
2

Executing a report with a "reportTemplate" parameter using Remote API

Re: Executing a report with a "reportTemplate" parameter using Remote API

I have solved my problem. It seems that this piece of code is the culprit: \"time_format\":\"%Y-%m-%E_%H:%M:%S\"

I have removed that piece in my code and then it worked. Any idea how do I fix this?

3

Executing a report with a "reportTemplate" parameter using Remote API

Re: Executing a report with a "reportTemplate" parameter using Remote API

It seems that I had to convert:
\"time_format\":\"%Y-%m-%E_%H:%M:%S\"
to:
\"time_format\":\"%25Y-%25m-%25E_%25H%3A%25M%3A%25S\"