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
List all methods of REST API and explain the API functionality
Login
Before calling any other API, client should login to ONEWEB because of security reasons. This App Runtime API is implemented using JWT. The application server is configured to verify that the incoming JWT are created by the authentication server. For example of client request see below
URL: http://[SERVER]:[PORT]/eaf-rest/login
HTTP Method: POST
HTTP Request Header: Content-Type : application/json
HTTP Request: {
"username" : [String: User Name],
"password" : [String: Password],
"ldapproviderurl" : [String: Empty value],
"clientId" : [String: key generate from client Ex. "93370c42-0d98-40ca-9a3d-36917a758b04"]
}
HTTP Response: {
"timestamp": [String: timestamp value Ex. "1510363014419"],
"validity": [Long: validity value Ex. 86400],
"id_token": [String: token value Ex. "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkbXBzeXN0ZW0iLCJjbGllbnRJZCI6ImFiYyIsImV4cCI6MTUxMTIyNzAxNCwiaXNzIjoiY29tLmF2YWxhbnQuand0In0.UXR5LbqWruWy3rJur2Lx2E1nfI73JX3QBQXA4c2u2_CTSSzceRRMyziGevhtRe16AzAgZGKhny3PdfNltIT5Hw"]
}
Search Entity
This API is used to search data from database by specific entity id and search parameter.
URL: http://[SERVER]:[PORT]/eaf-rest/entity/[Entity ID]/search?handleForm=Y&page=1&volumePerPage=10&cbMethod=searchHandler
HTTP Method: GET
HTTP Request Header: Content-Type : application/json, Authorization : "Bearer "+[Token], clientId : [Key generate from client]
HTTP Request: N/A
HTTP Response:searchHandler({
"ALL_VOLUME":"[Number of Record]",
"DATA":[{
"[Column Name 1]":"[Column Value 1]"
"[Column Name 2]":"[Column Value 2]"
..
"[Column Name n]":"[Column Value n]"
"KEY":{"ID":"[Key Value]"}
}]
});
Get Entity
After user uses search API, user can select a record to view detail. This API will return all information from database by entity id then user can edit, update or delete data on screen.
URL: http://[SERVER]:[PORT]/eaf-rest/entity/[Entity ID]/get?ID=[Key ID]&cbMethod=getRecordHandler
HTTP Method: GET
HTTP Request Header: Content-Type : application/json, Authorization : "Bearer "+[Token], clientId : [Key generate from client]
HTTP Request: N/A
HTTP Response: getRecordHandler({
"DATA":{
"ENTITY_ID":"[Entity ID]",
"MODULE_ID":{"[Module ID]":[{
"UPDATE":{
"[Table Name]":{
"[Column Name 1]":"Column Value 1",
"[Column Name 2]":"Column Value 2",
..
"[Column Name n]":"Column Value n",
"KEY":{"Key Column Name 1":"[Key Value 1]","Key Column Name":"[Key Value]"}
}
}
}]},
"MAIN_KEYTAB":{"MainTab Key Column Name":"[Key Value]"}
}
});
Save Entity
This API is used to insert data to database. After user enter new data on screen and click save button.