Execute an Action That Is Present in an Endpoint

To perform an action that is present in an endpoint by using the contract-based REST API, you access the needed URL with the POST HTTP method; you then pass the record representation in JSON format and the parameters of the action in the request body.

See the following sections for details on the request and the response.

HTTP Method and URL

If you need to perform an action on an MYOB Acumatica form, you use the POST HTTP method and the following URL.

http://<Base endpoint URL>/<Top-level entity>/<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 entity for which you are going to perform an action.
  • <Action name> is the name of the action that you are going to perform.

For example, suppose that you want to confirm a shipment 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 would use the following URL to confirm a shipment.

http://localhost/AcumaticaDB/entity/Default/23.200.001/Shipment/ConfirmShipment

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

You pass the record to which the action should be applied and the parameters of the action in the request body in JSON format as follows.
{
  "entity" : <record in JSON format>,
  "parameters" : <parameters in JSON format>
}
You can find details on how to represent a record in JSON format in Representation of a Record in JSON Format.

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.

Examples

Tip:
In the request examples 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 (such as https://my.acumatica.com) if the instance is installed in the root of the website.

The following request shows an example of a Completed sales order being reopened through the REST API.

POST /ReopenSalesOrder HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/SalesOrder
Accept: application/json
Content-Type: application/json

{ 
 "entity" :
 {
  "OrderType" : {"value" : "SO"}, 
  "OrderNbr" : {"value" : "000001"} 
 },
 "parameters" : 
 {}
}

The following request shows an example of the ID of the CANDYY business account being changed to CANDYYY through the REST API.

POST /ChangeBusinessAccountID HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/BusinessAccount
Accept: application/json
Content-Type: application/json

{
  "entity" : {
    "BusinessAccountID": { "value": "CANDYY" }
  },
  "parameters" : {
    "BusinessAccountID": { "value": "CANDYYY" }
  }
}