Wednesday, 14 September 2016

Acumatica REST API

HI All,

With Acumatica 6 release you can find (and actually use) new type of API - Rest API.
Acumatica 6 API

Acumatica Rest API is based on Contract based API, so here you have some important points:

  • You need to use existing or custom endpoint be able to send API calls
  • Field and container is available for REST API only if it is defined in contract. But you may extend existing contracts.
  • With REST API you have the same set of commands that you have with Contract Based API.
  • Acumatica uses Json format for transfer data between client and server
  • You still have to maintain session and authentication cookies.


Ok, lest try to do some examples. Here I will show you how to call Acumatica REST commands from Browser. By using this approach you can easily test functionality and just feel, how does it work.

To do so, we need a special tool. I will use PostMan extension for Google Chrome browser.
postman api builder
As we need to maintain session and cookies between calls, we also need to install Postman Interceptor extension.
postman api builder

Now we actually can login. To do so, we need to send our credentials for the specific url:

JSON data:
    "name" : "admin",
    "password" : "123",
    "company" :  ""
Response should be 204 No Content.

Ok, authentication is done, lets try to select data.


If we want some filtering or conditions, we just can use "OData" like filters - $filter=ItemStatus eq 'Active'

URL:$filter=ItemStatus eq 'Active'&$top=9

Additional parameters that you can use together with URL when you retrieve records from Acumatica ERP:
  • $filter: To specify filtering conditions on the records to be returned
  • $skip: To specify the number of records to be skipped from the list of returned records
  • $top: To specify the number of records to be returned in the list
  • $expand: To specify the linked and detail entities to be expanded
  • $custom: To specify the fields that are not defined in the contract to be returned

Getting Single Record
If you know key, you can easily get details about single record - just add key field to the url string:


You also can create new entity using REST API, in this case you need to use PUT method and send item details using JSON format. Name of the fields and containers you can get from Contract definition.


"InventoryID" : {value : "Kettler" } ,
"Description" : {value : "New Cool Kettler" },
"ItemClass" : {value : "ELECCOMP" }

Good news that the documentation on the REST API is included right within standard Acumatica Help. There you can find multiple examples and good code snippets that you can use from your favorite language/platform/code.

Have a nice integration!


Andrew Tainton said...


Thanks for the article, could you provide an example using an action?

Sergey Marenich said...

Hi Andrew,

You can use it like this:
http://[Base endpoint URL]/[Top-level entity]/[Action name]

You use the POST HTTP method and 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]

dkardell said...

How do you pass the filter? Your example has spaces in it?$filter=ItemStatus eq 'Active'&$top=9

Sergey Marenich said...

Hi Dkardell,
You should pass filters with query URL. And yes, you should have spaces there, but in the end spaces should be encoded as accordingly to standard URL encoding rules

Tim said...

Hi Sergey,

I'm trying to work with the REST APIs using PHP cURL code.

I'm testing by doing to calls in Postman: Login, Create a Customer. It works fine.

Then I generate the PHP cURL code and run the code in PHP, but I get an error on the second call: {"message":"You are not logged in."}

I'm thinking that Postman automatically passes the session information between calls.

So, I added Postman Interceptor and now I get back cookie information like this:

But, when I generate the PHP cURL code, it still doesn't generate the cookie information:
CURLOPT_POSTFIELDS => "{\r\n \"name\": \"admin\",\r\n \"password\": \"mypassword\",\r\n \"company\": \"Company\"\r\n}",
"cache-control: no-cache",
"content-type: application/json",
"postman-token: 3af0af99-e514-ab2e-4f69-7481a1b9c6ce"

$response = curl_exec($curl);
$err = curl_error($curl);


if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;

Do you know how to get the PHP cURL code that will pass the cookie information between API calls?

Tim said...

Hi Sergey,

Nevermind on this. I was able to get it to work.

I just had to figure out how to pass cookies between the requests. I couldn't figure out though how to post my successful PHP code sample here in the comments so I created a post on my blog instead.

You can go here for the successful PHP code that I used:

Sergey Marenich said...

Thank you for confirmation!

Benjamin Cadoche said...

Hi Sergey,
I am trying to use the action Prepare Invoice for a sales order with the instructions from your post dating 26th January.
I can't get it to work, do you think it is possible to do it for this action ?


Benjamin Cadoche said...

Hi Sergey,

Nevermind on this. I was able to get it to work.
I needed to add the PrepareInvoice action in web service endpoint SalesOrder.

Sergey Marenich said...

Thank you for confirmation. Ans sorry fore late replay, that is due to time-zones.

LAKKI said...

Hi Sergey,

Could you give an example of how the expand parameter can be used?
I tried the following but it did not work.$expand=SalesOrderDetail

VANNAK said...

Can we create record with custom field in rest api:
"OrderType": {value: "IN"},
"CustomerID" : {value : "1ARA" } ,
"Details" :[
"InventoryIDz": {value: "1BRO01"},
"InventoryID" : {value: "6DOC"}

Sergey Marenich said...

Hi Lakki,
Expand should add details records to result. In Expand you should pass name of container that exists in Acumatica Contract Endpoint.
But please note that it will significantly affect performance

Sergey Marenich said...

Yes, you can but you need to put custom fields in a special collection.
Please check here:

LAKKI said...

Hi Sergey,

Thank you for the reply.