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.