API - Correct syntax for calling reporting endpoints
The hardest part of running reports is getting the parameters correct for the PUT request.
Correct process is to first call to the Report Parameters endpoint:
https://developer.myob.com/api/exo/endpoints/report/reportparameters/
GET: {URI}/report/{reportname}
And then run the PUT request:
https://developer.myob.com/api/exo/endpoints/report/runreport/
PUT: {URI}/report/run/{reportname}
Consider the following PUT request to: {URI}/report/run/DRLStkGroupSales.CLR
Request Body: {
"id": "RunReportID123",
"notificationid": null,
"parameters": [
{
"name": "FromPeriod",
"value": "0"
},
{
"name": "ToPeriod",
"value": "0"
},
{
"name": "ToSecondary",
"value": "3"
}
]
}
And the response received
Response Error: {
"message": "Unknown parameter FromPeriod"
}
Error: Error: Error running report: Bad Request
There are 3 options that might cause the above problem
If the “id” of the request is missing.
The first parameter will show an Unknown parameter if the id value is missing.If the “id” of the request is invalid.
The id value must be the Report name to ensure this works correctly. In the above example it should beCODE"id": "DRLStkGroupSales.CLR",
If the parameter name isn’t correct.
The “Unknown parameter” error can also appear if you aren’t using the correct parameters, as specified from the get call to the Report Parameters endpoint:
https://developer.myob.com/api/exo/endpoints/report/reportparameters/
GET: {URI}/report/{reportname}
Full documentation for Running Reports in Exo Business is in the Developer centre.