Retrieve a Record by Key Fields
To retrieve a record by the values of its key fields from MYOB Acumatica by using the contract-based REST API, you access the needed URL with the
GET
HTTP method and specify the fields that should be returned
in the parameters of the method. See the following sections for details on the
request and the response.
HTTP Method and URL
GET
HTTP method and the following
URL.http://<Base endpoint URL>/<Top-level entity>/<Key value 1>/<Key value 2>
<Base endpoint URL>
is the URL of the contract-based endpoint through which you are going to work with MYOB Acumatica, which has the following format:http://<MYOB Acumatica instance URL>/entity/<Endpoint name>/<Endpoint version>/
.<Top-level entity>
is the name of the entity for which you are going to retrieve a record.<Key value 1>
and<Key value 2>
are the values of the key fields of the record to be retrieved. You use the number and order of key fields as they are defined on the corresponding MYOB Acumatica form.Note:You can pass the key fields separated by a vertical bar (|) instead of a slash (/). If the value of a key field contains a slash, you need to refer to a record by its entity ID instead of the values of its key fields.
For example, suppose that you want to retrieve the sales order with order type SO and order number 000123 from a local MYOB Acumatica instance with the name AcumaticaDB by using the system endpoint with the name Default and Version 23.200.001. You should use the following URL to retrieve the sales order.
http://localhost/AcumaticaDB/entity/Default/23.200.001/SalesOrder/SO/000123
Parameters
- $expand: To specify the linked and detail
entities to be expanded. For more information, see $expand Parameter.Note:In Contract Version 4, you are required to list in the $expand parameter every detail and related entity that you are going to have in the response body.
- $custom: To specify the fields that are not defined in the contract to be returned. For details about the parameter, see $custom Parameter.
- $select: To specify the fields of the entity to be returned. For more information about the parameter, see $select Parameter.
For detailed descriptions of the parameters, see Parameters for Retrieving Records.
Request Headers
You can specify the following header in the request.
Header | Description |
---|---|
Accept |
Specifies the format of the response body, which should be application/json. |
Response Status Codes
The following table lists the HTTP status codes that the system returns for a request that retrieves a record by the values of key fields.
Code | Description |
---|---|
200 | The request has been completed successfully. The response contains the requested record. |
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 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
<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.GET /SO/000001?$expand=Details HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/SalesOrder
Accept: application/json
Content-Type: application/json