Execute a Processing Action for Selected 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 command by using the contract-based REST API in two stages:

  1. 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).
  2. In the body of the second request, you use the response that you received in the first stage to execute the Process command for the records that you have selected. (This topic provides information on the corresponding action.)
Important: You must run both requests during the same session.

HTTP Method and URL

In the table of a processing form, you select the check boxes in the untitled column for the records you want to process; you then click Process on the form toolbar of the form. To process selected records by using the contract-based REST API, you use the POST HTTP method and the following URL.

POST http://<Base endpoint URL>/<Top-level entity>/<Process action name>
The URL has the following components:
  • <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 action name> is the name of the action to which the Process command is mapped in the endpoint.

For example, suppose that you want to execute the Process 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 HTTP method and URL to execute the Process command.

POST http://localhost/AcumaticaDB/entity/Default/23.200.001/EmailProcessing/ProcessEmailProcessing

Parameters

You use no parameters when you execute an action.

Request Headers

You can specify the following headers in the request.

HeaderDescription
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 response body received when selection criteria were applied to filter records (see Narrow the List of Records on a Processing Form). Further, you change the request body as follows: for each record, in the Selected field, you specify either true (if the record must be processed) or false (if the record must not be processed).

Request Headers

You can specify the following headers in the request.

HeaderDescription
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.

Response Status Codes

The following table lists the HTTP status codes that the system returns for a request that performs an action.

CodeDescription
202The 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.
204The 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.

404An 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.

"CustomerID": {
 "value": "ABARTENDE1",
 "error": "'Customer' cannot be found in the system."
}
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 some pending emails in an MYOB Acumatica instance. In the UI, you select the desired emails on the Emails Pending Processing (SM507000) form and click Process for this purpose. This form is mapped to the EmailProcessing entity, which has the ProcessEmailProcessing action; this action corresponds to the Process button.

Following is an example of a request that processes the first email from the list that is retrieved in the example provided in Narrow the List of Records on a Processing Form. The Selected field of the first record contains true and the rest ones contain false.

Tip: In the request example below, <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 /ProcessEmailProcessing HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/EmailProcessing
Accept: application/json
Content-Type: application/json

{
    "Entity": {
        "id": "5cfd60d5-c5d6-4ac9-aa03-06ac083ce329",
        "rowNumber": 1,
        "note": null,
        "Account": {},
        "AccountEmailAccountID": {},
        "AssignedToMe": { "value": true },
        "AssignedToOwner": {},
        "IncludeFailed": { "value": false },
        "Result": [
            {
                "id": "8f5174a5-b312-ea11-b826-00155d408001",
                "rowNumber": 1,
                "note": { "value": "" },
                "EmailAccount": { "value": "System" },
                "From": { "value": "\"System\" <system@sweetlife.con>" },
                "MailStatus": { "value": "Pending Processing" },
                "Owner": {},
                "Selected": { "value": true },
                "StartDate": { "value": "2023-12-03T14:59:30.693+03:00" },
                "Subject": { "value": "Welcome to the Company2 system" },
                "To": { "value": "angelo@sweetlife.com" },
                "custom": {},
                "_links": {
                    "files:put": ...
                }
            },
            {
                "id": "4d57b6f3-b312-ea11-b826-00155d408001",
                "rowNumber": 2,
                "note": { "value": "" },
                "EmailAccount": { "value": "System" },
                "From": { "value": "\"System\" <system@sweetlife.con>" },
                "MailStatus": { "value": "Pending Processing" },
                "Owner": {},
                "Selected": { "value": false },
                "StartDate": { "value": "2023-12-03T14:59:36.15+03:00" },
                "Subject": { "value": "Welcome to the Company2 system" },
                "To": { "value": "perkins@sweetlife.com" },
                "custom": {},
                "_links": {
                    "files:put": ...
                }
            },
            ...
        ],
        "Type": { "value": "All" },
        "custom": {}
    }
}