1

Ошибка при получение отчета (API)

(edited by kpoiii92 24/05/2023 21:56:45)

Topic: Ошибка при получение отчета (API)

Добрый день, в чем может быть проблема?

/wialon/ajax.html?svc=report/exec_report&sid=hgfbv53hgfrf432d

Тело пост

params={
"reportResourceId": 22563712,
"reportTemplateId": 0,
"reportObjectId": 25118133,
"reportObjectSecId": 0,
"interval": {
"from": 1684875600,
"to": 1684962000,
"flags": 0
},
"reportTemplate": {
"tbl": [
{
"p": "{\"address_format\":\"1255211008_10_5\",\"time_format\":\"%E.%m.%Y_%H:%M:%S\",\"us_units\":0}",
"f": 0,
"filter_order": [],
"s": "[\"address_format\",\"time_format\",\"us_units\"]",
"sl": "[\"Address\",\"Time Format\",\"Measure\"]",
"cp": "",
"cl": "",
"sch": {
"fl": 0,
"w": 0,
"m": 0,
"y": 0,
"t2": 0,
"t1": 0,
"f2": 0,
"f1": 0
},
"c": "",
"l": "Статистика",
"n": "unit_stats"
},
{
"p": "",
"f": 0,
"filter_order": [
"base_eh_sensor",
"duration",
"mileage",
"engine_hours",
"speed",
"trips",
"stops",
"parkings",
"sensors",
"sensor_name",
"driver",
"trailer",
"fillings",
"thefts",
"geozones_ex"
],
"s": "",
"sl": "",
"cp": "[{},{},{},{},{},{},{},{}]",
"cl": "[\"Моточасы\",\"Холостой ход\",\"Пробег\",\"Ср. скорость\",\"Ср. расход\",\"Начало\",\"Конец\",\"Вес груза\"]",
"sch": {
"fl": 0,
"w": 0,
"m": 0,
"y": 0,
"t2": 0,
"t1": 0,
"f2": 0,
"f1": 0
},
"c": "[\"duration\",\"duration_stay\",\"mileage\",\"avg_speed\",\"avg_fuel_consumption_all\",\"time_begin\",\"time_end\",\"loading_avg_weight\"]",
"l": "Моточасы",
"n": "unit_engine_hours"
}
],
"p": "{\"descr\":\"\",\"bind\":{\"avl_unit\":[]}}",
"ct": "avl_unit",
"n": "АМ_Моточасы",
"id": 0
}
}

Ошибка
{"error":4,"reason":"WRONG_PARAMS"}

2

Ошибка при получение отчета (API)

Re: Ошибка при получение отчета (API)

kpoiii92 здравствуйте, в запросе все специальные символы должны быть в кодировке URL-encode. В данном случае значение формата времени (time_format) необходимо кодировать в таком формате: %25E.%25m.%25Y_%25H%3A%25M%3A%25S

Пример выполняемого без ошибки запроса:

hst-api.wialon.com/wialon/ajax.html?svc=report/exec_report&params={"reportResourceId":22563712,"reportTemplateId":0,"reportObjectId":25118133,"reportObjectSecId":0,"interval":{"from":1684875600,"to":1684962000,"flags":0},"reportTemplate":{"tbl":[{"p":"{\"address_format\":\"1255211008_10_5\",\"time_format\":\"%25E.%25m.%25Y_%25H%3A%25M%3A%25S\",\"us_units\":0}","f":0,"filter_order":[],"s":"[\"address_format\",\"time_format\",\"us_units\"]","sl":"[\"Address\",\"Time Format\",\"Measure\"]","cp":"","cl":"","sch":{"fl":0,"w":0,"m":0,"y":0,"t2":0,"t1":0,"f2":0,"f1":0},"c":"","l":"Статистика","n":"unit_stats"},{"p":"","f":0,"filter_order":["base_eh_sensor","duration","mileage","engine_hours","speed","trips","stops","parkings","sensors","sensor_name","driver","trailer","fillings","thefts","geozones_ex"],"s":"","sl":"","cp":"[{},{},{},{},{},{},{},{}]","cl":"[\"Моточасы\",\"Холостой ход\",\"Пробег\",\"Ср. скорость\",\"Ср. расход\",\"Начало\",\"Конец\",\"Вес груза\"]","sch":{"fl":0,"w":0,"m":0,"y":0,"t2":0,"t1":0,"f2":0,"f1":0},"c":"[\"duration\",\"duration_stay\",\"mileage\",\"avg_speed\",\"avg_fuel_consumption_all\",\"time_begin\",\"time_end\",\"loading_avg_weight\"]","l":"Моточасы","n":"unit_engine_hours"}],"p":"{\"descr\":\"\",\"bind\":{\"avl_unit\":[]}}","ct":"avl_unit","n":"АМ_Моточасы","id":0}}&sid=ВАШ_SID
Anton Zinovyev
Technical Care Engineer (L2)
Wialon