Execute a Processing Action for All Filtered Records
A processing form contains selection criteria, a table with the filtered records (the records that meet the selection criteria), and two main buttons that are usually named Process and Process All. You execute the Process All command by using the contract-based REST API in two stages:
- You run a request to retrieve the records for processing that meet the desired selection criteria (see Narrow the List of Records on a Processing Form).
- In the body of the second request, you use the
id
value from the response that you received in the first stage to execute the Process All command, which affects all filtered records. (This topic provides information on the corresponding action.)
HTTP Method and URL
You click Process All on the form toolbar of a processing form
to process all records contained in the table of this form. To process all listed
records by using the contract-based REST API, you use the POST
HTTP
method and the following URL.
http://<Base endpoint URL>/<Top-level entity>/<Process All action name>
<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 top-level entity that corresponds to the processing form.<Process All action name>
is the name of the action to which the Process All command is mapped in the endpoint.
For example, suppose that you want to execute the Process All command of the Emails Pending Processing (SM507000) form in 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 execute the Process command.
http://localhost/AcumaticaDB/entity/Default/23.200.001/EmailProcessing/ProcessAllEmailProcessing
Parameters
You use no parameters when you execute an action.
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
As a request body, you create a JSON object with the only Entity key; as the value, you use the key-value pair with the id key that is taken from the response body received when the selection criteria were applied (see Narrow the List of Records on a Processing Form).
Response Status Codes
The following table lists the HTTP status codes that the system returns for a request that performs an action.
Code | Description |
---|---|
202 | The operation is in progress. The Location header of the response contains the URL that you can use to check the status of the operation by using the GET HTTP method. When the GET HTTP method with this URL returns 204 No Content, the operation is completed. |
204 | The operation that has been initiated by the action has completed or was not created. |
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 entity. |
404 | An action with this name does not exist. |
422 | The data specified in the request is invalid and the validation errors are returned in the error fields of the response body, as in the following example.
|
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
For example, suppose that you want to process all incoming and outgoing pending
emails assigned to the current user in an MYOB Acumatica instance. On the UI, the Emails Pending Processing (SM507000)
form can be used for this purpose. This form is mapped to the
EmailProcessing
entity, which has the
ProcessAllEmailProcessing
action; this action corresponds to
the Process All button.
Following is an example of a request that processes all the pending emails that are retrieved in the example provided in Narrow the List of Records on a Processing 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.POST /ProcessAllEmailProcessing HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/EmailProcessing
Accept: application/json
Content-Type: application/json
{
"Entity": {"id": "e269bafb-a6c0-4463-a3ad-e8b3eab203d4"}
}