Step 1- configure entity to get data by REST API. For this example, we will prepare entity named Work Order. This Entity includes 3 Tabs and 4 Modules. See picture below.
Step 2 - Get Key Data to send parameters into the URL. The image below is the Update Screen of Work Order. For this example, the key is sale_order_no and the value is 0000000010.
Step 3 - The login process uses Post Method. Run URL http://localhost:9084/eaf-rest/login with parameter Content-Type: application/json and Body contains 3 values in JSON format. "username" : "administrator", "password" : "P@55w0rd", "clientId" : "123456789" After run login URL, the system will return id_token for use in other process. See picture below.
Step 4 - Call URL to get data from Entity. The Format is ServerName, Port, Context
Root and Parameter Value.
Format: ServerName:Port/Context Root/Parameter Value
Step 5 - Set the following 3 Header parameters as shown below.
Content-Type: application/json
Authorization: Start value Bearer then space and token id received from login process.
clientId: use clientId same as in login process.
Step 6 - Run Step 3 and Step 4 to get result JSON DATA as in picture below
JSON Data contains following fields.
ENTITY_ID value of entityID
MODULE_ID value of moduleID
UPDATE is process mode
SALE_ORDER_ITEM is table name
PRODUCT_ID, PRODUCT_NAME etc. is field name
KEY is the key of module/record In this Data will see ModuleID 4 value which is same with configuration of this entity.
You already saw how to get data from entity. Now assume another application need to find customer contact from Order No. You can get the information by REST API.
Step 1 - In the Login Screen enter the userName value and call Login REST.
Step 2 - Use Ajax to call Rest Service to keep id_token into session for use by other processes.
Step 3 - Prepare Screen to Input Order No.
Step 4 - Input value Order No, then click Find Customer contact.
Step 5 - use the JavaScript function to call Ajax REST API to get Data Customer contact by passing parameter Order No. In headers set Content-Type, Authorization (use id_token from the session), and clientId from the login process.
Step 6 - call REST API and get JSON DATA. The highlighting module has CUST_CONTACT which need result. It can get Data from JSONObject through MODULE_ID > UPDATE > SALE_ORDER_DELIVERY > CUST_CONTACT.
Step 7 - Use JQuery or JavaScript to Display Result Data.
A REST API breaks down a transaction to create a series of small modules. Each module addresses a particular underlying part of the transaction. This modularity provide developers with a lot of flexibility, but it can be challenging for developers to design from scratch. Currently, Sample use cases for APP Runtime API are Mobile App and Custom App.
Mobile App. Mobile App is an application which communicates with server and mobile over the internet by using REST API.
Example Login Mobile App
Features like Key-in Username & Password, Log on with all case, Forgot Password, Remind me later are all actions from mobile to Server which communicate through internet by REST API.
Custom App.
Custom App is application which communicate with server and web application by using REST API.
Example Work Order
Create Order Item, Search Contact, View Order, Calculate Order and so on is action by User to communicate with Server by Rest API from Custom App.
The App Runtime provides a list of REST APIs so that users from other systems can interact with the entities created in App Designer using the REST. This REST API in APP Runtime can be used to insert, update and delete the entity configuration in database. This section gives the details of the methods provided by the APIs. The methods can be added to the context root to call the service.
Request
Description
HTTP Method
1. /login
Login Process for get token id.
POST
2. /entity/{entityID}/search
Search Data in {entityID} by parameter in URL after running you will get data Json Format from {entityID}.
GET
3. /entity/{entityID}/get
Get Data Json Format from {entityID} after you pass parameter key in URL, you will get JSON data in all module of entity.
GET
4. /entity/{entityID}/save
Save Data JSON Body of {entityID} into Database.
POST
5. /entity/{entityID}/delete
Delete Data in Database from key parameter.
POST
6. /entities/save?mainEntityID={entityID}
Save Data JSON Body of {entityID} in Parent, Child Tab format into Database.
POST
7. /file/upload
Upload File into Server following configuration.
POST
8. /file/{id}/download
Download File From {id} which is uploaded from server.
GET