Retrieve Data from an Inquiry Form
To retrieve data from an inquiry form of MYOB Acumatica by using the contract-based REST API, you access the needed URL with the
PUT
HTTP method and pass the parameters of the inquiry 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 data from an inquiry form, you use the PUT
HTTP method and the following URL.
PUT http://<Base endpoint URL>/<Top-level entity>
PUT
method is always used to retrieve data from an
entity that is mapped to a generic inquiry. This is because generic inquiries can
contain parameters whose values you may need to specify by passing their values in
the body of the request.- <Base endpoint URL> is 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>/.
- <Top-level entity> is the name of the entity that corresponds to the generic inquiry form you are going to retrieve data from.
For example, suppose that you want to retrieve data from the Inventory Summary (IN401000) form in a local MYOB Acumatica instance with the name AcumaticaDB by using the system endpoint with the Default name and Version 24.200.001. You would use the following URL to retrieve data: http://localhost/AcumaticaDB/entity/Default/24.200.001/InventorySummaryInquiry.
Parameter
When you are retrieving data from an inquiry form, you have to use the $expand parameter to expand the detail entity, which contains the results of the inquiry. For a detailed description of the parameter, see Parameters for Retrieving Records.
Request Headers
You can specify the following headers in the request.
Header | Description |
---|---|
Accept | Specifies the format of the response body, which should be application/json. |
Content-Type | Specifies the format of the request body, which should be application/json. |
Request Body
{
"InventoryID" : {"value" : "APJAM08" } ,
"WarehouseID" : {"value" : "RETAIL" }
}
Response Status Codes
The following table lists the HTTP status codes that the system returns for a request that retrieves data from an inquiry form.
Code | Description |
---|---|
200 | The request has been completed successfully. The response body contains the data retrieved from the inquiry form. |
400 |
The data specified in the request is invalid. |
401 |
The user is not signed in to the system. |
403 |
The user has insufficient rights to access the MYOB Acumatica form that corresponds to the API entity. |
429 |
The number of requests has exceeded the limit imposed by the license (see License Restrictions for API Users). |
500 |
An internal server error has occurred. |
Example
The following request shows an example of the retrieval of data from the Inventory Summary (IN401000) inquiry form.
<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 (that is, you can use https://my.acumatica.com) if the instance
is installed in the root of the website.PUT /entity/Default/24.200.001/InventorySummaryInquiry?
$expand=Results HTTP/1.1
Host: [<MYOB Acumatica instance URL>]
Accept: application/json
Content-Type: application/json
{
"InventoryID" : {"value" : "SIMCARD" } ,
"WarehouseID" : {"value" : "YOGI" }
}
Example: Custom Generic Inquiry
The following request shows an example of the retrieval of data from the Item Availability Data (INGI0002) custom generic inquiry.
No entity is mapped to the custom generic inquiry in the system endpoints, which are provided in MYOB Acumatica by default. Thus, to export data from this generic inquiry by using the contract-based API, you need to use a custom endpoint or an extension of an existing endpoint. In this example, the ItemAvailabilityData/0001 custom endpoint is used.
PUT /entity/ItemAvailabilityData/0001/ItemAvailabilityDataInquiry?
$expand=ItemAvailabilityDataInquiryDetails HTTP/1.1
Host: [<MYOB Acumatica instance URL>]
Accept: application/json
Content-Type: application/json
{}