lenny
(Lenny Chavhunduka)
April 22, 2020, 12:35am
#1
Refer to attached image.
The reporting module’s REST API is not accepting report parameters using the JSON format as per documentation. I am testing the API using Advanced rest Client Chrome plugin. Below is my request body json:
{
"parameters": [
{
"facility_code": "xxxxxx",
"month": "12",
"year": "2019",
"user": "User1"
}
]
}
I get the error message below, yet the parameter is specified in the json.
{
"error": "Run report error",
"details": "Required report parameter "facility_code" not found"
}
albudarov
(Alexander Budarov)
April 22, 2020, 6:58am
#2
Hi,
I’m sorry but reporting manual suggests different syntax to pass parameters:
https://doc.cuba-platform.com/reporting-7.2/rest_reports.html#rest_reports_run
The report parameters are passed in the request body:
{parameters: [{name: ‘author’,value: ‘4b3a21b0-d6b7-4161-b0b6-55f118fbaac5’}]}
So in your case it should be:
{
"parameters": [
{name: "facility_code", value: "xxxxxx"},
{name: "month", value: "12"},
...
}
]
}
lenny
(Lenny Chavhunduka)
April 22, 2020, 10:35am
#3
It worked. Thank you very much.