How to use CozyRoc Acumatica Connector Actions Read, Create, Update and Delete Http (Methods)

How to use COZYROC Acumatica Connector Actions Read, Create, Update and Delete ( Http Methods )

Acumatica is the complete Cloud ERP solution for all your business management needs today and in the future.

COZYROC Acumatica Connector 
With COZYROC Acumatica Connector external systems can;
  1. GET data records from Acumatica ERP.
  2. PROCESS the records.
  3. CREATE new or updated current records to Acumatica ERP
  4. DELETE the current records.
  5. EXECUTE actions that are available in Acumatica contract-based REST API. 
COZYROC Acumatica Connector is inherited from two Templates.
  1.  Base Template.
  2.  Inquiry Template
Base Template: Resources that are not using HTTP (PUT) method for READ (Action) element but using HTTP (GET) method are inherited from Base Template. No need to manually pass $expand and $select parameter.  You can simply select fields from the column tab that will generate a select query automatically and add it to the query URL. Below we will walk through a simple example using the resource Account.

Example: Resource Account
Let assume we are only interested in data for the columns AccountCD and AccountClass, We can deselect the rest of the columns and select only AccountCD and AccountClass as mention in below below screen shot 1.0 highlighted red.

Screen Shot 1.0


We will only get the data for AccountCD and AccountClass after I hit the preview tab, since the configuration will generate the select query automatically based on the fields you select and add it to the invoking endpoint URL as query parameters. You can see in the below screen shot 1.1, how the call to the endpoint looks. 

Screen Shot 1.1
In the above examples as mentioned in screen shot 1.0 and 1.1 we learn about how the $select parameter works. Now lets talk about the $expand parameter. You use this parameter to specify the linked and details entities that should be expanded and are present in the contract-based REST API endpoints. By default no linked and details entities are expanded; that is, only fields from the top level entity are returned. Below we will walk through a simple example where we will use the resource "Carrier".

Example: Resource Carrier
By default there are two linked entities present in the Resource Carrier endpoint with the name CustomerAccounts and PlugInParameters as you can see in the below screen shot 1.2 circled red.
Screen Shot 1.2
 As you can see in the above screen shot 1.2, the linked entities are initially deselect. If you want to retrieve the linked and details entities, all you have to do is check the box and hit preview tab. COZYROC Acumatica Connector will automatically generate the $expand query and add it to the invoking endpoint call as a query parameters mentioned in the below screen shot 1.3 underlined red

Screen Shot 1.3
Inquiry Template: Base Template: Resources (Inquiry Forms) that are using HTTP (PUT) method for READ (Action) are inherited from the Inquiry Template. There is no need to manually pass $expand and $select parameter.  You can simply select fields from the column tab that will generate a select query automatically and add it to the query URL. Since the Http (PUT) method require a request Body, the configuration will automatically send ( body { } ) in the request body if there are no parameters defined, since the API required a request body. Details can be fine here

Execution of Action: To perform an action by using COZYROC Acumatica Connector, you will have to  select the Resource name, CREATE action, and pass the action name that is present in the Acumatica endpoint using the default set parameter actionName in COZYROC Rest Destination component. The below mentioned screen shots contain details about the execution of the action.

    Actions that are present in the Bill Endpoint
           Pass the record  in JSON format
       CozyRoc Rest Destination Component
Screen Shot 1.4

Screen Shot 1.5

Screen Shot 1.5


Screen Shot 1.4:  The actions that are present in the Resource Bill in Acumatica contract-based REST API.
Screen Shot 1.5:  Representation of data in JSON format that will be send in request body.
Screen Shot 1.5:  Using COZYROC Rest Destination component we select the Resource Bill, action create and pass one of the actions that are present in Resource Bill endpoint using actionName parameter.
COZYROC Acumatica Connector will behind the scene convert the request body structure as mention below.
{
  "entity" :  { "Type" : { "value" : "Bill" }, "ReferenceNbr": { "value" : "01010" } } 
}
If the action required parameters you can use the same representation of JSON record as shown in screen shot 1.5 with extended parameters object that will contain all the parameters data as mentioned below.
{ "type": "Bill", "ReferenceNbr": "0010", "parameters": { "value" : "null", "value": "null"} }
COZYROC Acumatica Connector will behind the scene structure the JSON representation of data as mentioned below.
 { "entity" : { <record in JSON format> },
  "parameters" : { <parameters in JSON format> } }
Creation and Updating of record: Using UPDATE action in COZYROC Rest Destination component, you can either create a new record or update the current record. Details can be found here regarding creation or updating of the record.

Deletion of the record: Using DELETE action in COZYROC Rest Destination component, you can delete the records. You can provide the id (guid) of the record in order to perform DELETE action.