Retrieve Records Filtered by Custom Fields
If you use the REST API, to retrieve records that satisfy the specified conditions for
custom fields from MYOB Acumatica, you access the needed URL with the GET
HTTP method and specify
filtering conditions in the parameters of the method. See the following sections for details
on the request and the response.
HTTP Method and URL
If you need to retrieve the list of records that satisfies the specified conditions, you use the GET
HTTP method and the following URL.
GET http://<Base endpoint URL>/<Top-level entity>
<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 for which you are going to retrieve the list of records.
For example, suppose that you want to retrieve the list of stock item records 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 list of records.
http://localhost/AcumaticaDB/entity/Default/23.200.001/StockItem
Parameters
To retrieve records filtered by custom fields, you use the $filter parameter.
You can use the following custom function to filter
records by the values of custom fields: cf.<Type name>(f='<View
name>.<Field name>')
, where <Type name>
is the type
of the custom element, <View name>
is the name of the data view that
contains the element, and <Field name>
is the name of the
element.
For more information on the use of the $filter parameter, see $filter Parameter.
For other parameters that can be used in the request, see Retrieve Records by Conditions.
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 records by conditions.
Code | Description |
---|---|
200 | The request has been completed successfully. The response body contains the list of records that satisfy the specified conditions. |
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 $filter=cf.Decimal(f='Document.CuryBalanceWOTotal') eq 0M and
cf.DateTime(f='Document.DiscDate') gt datetimeoffset'2024-02-18T23%3A59%3A59.999%2B04%3A00' HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/SalesInvoice
Accept: application/json
Content-Type: application/json