Request a Report
To request a report by using the contract-based REST API, you access the needed URL
with the POST
HTTP method. You pass the parameters of the report in
JSON format in the request body.
See the following sections for details on the request and the response.
HTTP Method and URL
If you need to retrieve a report from MYOB Acumatica, you use the POST
HTTP method and the following URL.
POST http://<Base endpoint URL>/<Report entity>
<Base endpoint URL>
: The URL of the contract-based endpoint through which you are going to work with MYOB Acumatica. This URL has the following format:http://<MYOB Acumatica instance URL>/entity/<Endpoint name>/<Endpoint version>/
.<Report entity>
: The name of the entity that corresponds to the report that you are going to obtain.
For example, suppose that the created custom endpoint has the http://localhost/AcumaticaDB/entity/Report/0001/ URL and the CashAccountSummary report entity. The developer would use the following HTTP method and URL.
POST http://localhost/AcumaticaDB/entity/Report/0001/CashAccountSummary
Parameters
You use no parameters when you request a report from MYOB Acumatica.Request Headers
You can specify the following headers in the request.
Header | Description |
---|---|
Accept | Specifies the format in which the report should be returned. The
format (and the respective header value) can be one of the
following:
Accept header is not specified, the
report is returned in PDF format. |
Content-Type |
Specifies the format of the request body, which should be application/json. |
Accept-Language |
Specifies the language in which the report should be returned from MYOB Acumatica. The header value can be one of the following:
|
Request Body
In the request body, you specify the parameters of the report in JSON format, as shown in the following example.{
"CompanyBranch": {"value": "SOFT"},
"IncludeNonClearedTransactions": {"value": true}
}
If no parameters are specified in the request body, the default parameters of the report are used.
You can find details on how to represent a record in JSON format in Representation of a Record in JSON Format.
Response Status Codes
The following table lists the HTTP status codes that the system returns for a request for a report.
Code | Description |
---|---|
202 | The operation is in progress. The Location
header of the response contains the URL that you can use to obtain
the requested report by using the GET HTTP method.
When the report is ready, this GET request returns
the 200 OK status code. The requested report is returned in
the response body. |
400 |
The data specified in the request is invalid. |
401 |
The user is not signed in to the system. |
500 |
An internal server error has occurred. |
Response Body
After the request succeeds, the response body is empty.
Example
<MYOB Acumatica instance URL>
is the URL of the MYOB Acumatica
instance (such as https://my.acumatica.com/MyInstance
). You can omit
the instance name in the URL (such as https://my.acumatica.com
) if the
instance is installed in the root of the website.POST /entity/Report/0001/CashAccountSummary HTTP/1.1
Host: [<MYOB Acumatica instance URL>]
Accept: application/pdf
Content-Type: application/json
{
"CompanyBranch": {"value": "SOFT"},
"IncludeNonClearedTransactions": {"value": true}
}
The response of the successful request contains the Location
header
similar to the following: /<instance
name>/entity/Report/0001/CashAccountSummary/report/PDF/7049baf4-9387-4dd4-9eb5-e975cc8d1a96
.
When the report is ready, a GET request to this URL returns the
requested report in the response body.