Tutorials

Support : Tutorials
API Builder

Learn how to format API requests, to query adhoc data, or to format an interface retrieval to be used by another application using CoreTRM API Builder.

Tutorial

Let's create a simple API that queries all contract numbers within a date period from 2019-09-01 to 2019-09-15 that has quantity of greater than 100,000 units.

Example: api/{tenantid}/dataobjectdata/core_contract_item?itemrefs=contractseqnum&sortitemrefs=contractseqnum&filter=startdatetime.ge.2019-09-01.and.enddatetime.lt.2019-09-15&perpage=12

Go to System Admin > API Builder > API Requests

Under "API Request" > "New" > Add "Request Name" as "Query Contract Number".

API builder

From "Object" > Select "Contract Item".

API builder

Under "Item Refs" Select magnifier > "contract item" > "contractseqnum" > Apply.

Under "Sort Item Refs" repeat the same by Selecting magnifier > "Contract Item" > "contractseqnum" > Apply

API builder

Now we need to setup the query parameters.

Add New under "Filter" Assign: 101 to "Order Number".

API builder

Under "Left Item Ref" Select magnifier > "contract item" > "startdatetime"

API builder

Under "Condition" Select "greater than or equal to".

Under "Right Value"Enter the start date to query in YYYY-MM-DD "2019-09-01".

API builder

Create a new "Order" number" at 102 > Similarly selecting "Contract Item", select "enddatetime" and input "2019-09-15"

Create another new "Order" number" at 103 > Selecting "Contract Item", select "contractitemquantity" and input "100000"

Make sure the "Active" box are ticked for all three order number.

API builder

Select the "API Request" Query Contract Number that you just created at top of page.

CoreTrm API Builder will automatically build the formatted API address.

Execute "GET" and you will see the JSON output per below.

API builder

Go to System Admin > API Builder > API Requests

Under "API Request" > "New" > Add "Request Name" as "Query Contract Number".

API builder

From "Object" > Select "Contract Item".

API builder

Under "Item Refs" Select magnifier > "contract item" > "contractseqnum" > Apply.

Under "Sort Item Refs" repeat the same by Selecting magnifier > "Contract Item" > "contractseqnum" > Apply

API builder

Now we need to setup the query parameters.

Add New under "Filter" Assign: 101 to "Order Number".

API builder

Under "Left Item Ref" Select magnifier > "contract item" > "startdatetime"

API builder

Under "Condition" Select "greater than or equal to".

Under "Right Value"Enter the start date to query in YYYY-MM-DD "2019-09-01".

API builder

Create a new "Order" number" at 102 > Similarly selecting "Contract Item", select "enddatetime" and input "2019-09-15"

Create another new "Order" number" at 103 > Selecting "Contract Item", select "contractitemquantity" and input "100000"

Make sure the "Active" box are ticked for all three order number.

API builder

Select the "API Request" Query Contract Number that you just created at top of page.

CoreTrm API Builder will automatically build the formatted API address.

Execute "GET" and you will see the JSON output per below.

API builder