You can use the following APIs to manage the application and transaction-to-cache mapping.
Note
LoadOne and LoadAll can work whether the application settings are stored in the file or in the database; the other APIs can only work when the settings are stored in the database. See Storing database connections in the database for how to store the settings in a database (instead of the default file).
Syntax |
Description |
---|---|
Loads the configuration of an application. |
|
Loads the configuration of all applications. |
|
Adds an application and configuration. |
|
Edits the configuration of an application. |
|
Removes an application and configuration. |
|
/api/Application/AddTransactionMapping/{appName}/{transName} |
Adds a transaction-to-cache mapping. |
/api/Application/EditTransactionMapping/{appName}/{transName} |
Edits a transaction-to-cache mapping. |
/api/Application/RemoveTransactionMapping/{appName}/{transName} |
Removes a transaction-to-cache mapping. |
Loads the configuration of an application.
Syntax: GET /api/Application/LoadOne/{appName}
{appName} indicates the application to be loaded, for example, salesdemo_cloud.
PowerScript code example:
Integer li_rc String ls_body httpclient lhc_client lhc_client = create httpclient lhc_client.setrequestheader("Content-Type", "application/json;charset=UTF-8",true) li_rc = lhc_client.sendrequest( "GET", "http://172.25.100.32:5000/api/Application/LoadOne/salesdemo_cloud") if li_rc = 1 and lhc_client.getresponsestatuscode( ) = 200 then lhc_client.getresponsebody(ls_body) end if
When successful, it returns the response status code 200 and the following response body. View here for details about the parameters in the response body.
When failed, it returns 400 (bad request), 401 (unauthorized), or 500 (server error).
{ "applicationName": "string", "configuration": { "runMode": 0, "session": { "timeout": 0 }, "request": { "timeout": 0 }, "transaction": { "timeout": 0, "transactionException": true }, "cloudTransactions": { "additionalProp1": { "cacheName": "string" }, "additionalProp2": { "cacheName": "string" }, "additionalProp3": { "cacheName": "string" } } } }
Loads the configuration of all applications.
Syntax: GET /api/Application/LoadAll
PowerScript code example:
Integer li_rc String ls_body httpclient lhc_client lhc_client = create httpclient lhc_client.setrequestheader("Content-Type", "application/json;charset=UTF-8",true) li_rc = lhc_client.sendrequest( "GET", "http://172.25.100.32:5000/api/Application/LoadAll") if li_rc = 1 and lhc_client.getresponsestatuscode( ) = 200 then lhc_client.getresponsebody(ls_body) end if
When successful, it returns the response status code 200 and the following response body. View here for details about the parameters in the response body.
When failed, it returns 400 (bad request), 401 (unauthorized), or 500 (server error).
[ { "applicationName": "string", "configuration": { "runMode": 0, "session": { "timeout": 0 }, "request": { "timeout": 0 }, "transaction": { "timeout": 0, "transactionException": true }, "cloudTransactions": { "additionalProp1": { "cacheName": "string" }, "additionalProp2": { "cacheName": "string" }, "additionalProp3": { "cacheName": "string" } } } } ]
Adds an application and configuration.
Syntax: POST /api/Application/Add
When successful, it returns the response status code 200 and the following response body.
When failed, it returns 400 (bad request), 401 (unauthorized), or 500 (server error).
{ "isSucceeded": true, "errorMessage": "string" }
Edits the configuration of an application.
Syntax: POST /api/Application/Edit
When successful, it returns the response status code 200 and the following response body.
When failed, it returns 400 (bad request), 401 (unauthorized), or 500 (server error).
{ "isSucceeded": true, "errorMessage": "string" }
Removes an application and configuration.
Syntax: POST /api/Application/Remove/{appName}
{appName} indicates the application to be removed, for example, salesdemo_cloud.
When successful, it returns the response status code 200 and the following response body.
When failed, it returns 400 (bad request), 401 (unauthorized), or 500 (server error).
{ "isSucceeded": true, "errorMessage": "string" }
Adds a transaction-to-cache mapping.
Syntax: POST /api/Application/AddTransactionMapping/{appName}/{transName}
{appName} indicates the application name, for example, salesdemo_cloud.
{transName} indicates the transaction object to be added, for example, sqlca1.
PowerScript code example:
Integer li_rc String ls_body , ls_requestbody httpclient lhc_client lhc_client = create httpclient lhc_client.setrequestheader("Content-Type", "application/json;charset=UTF-8",true) ls_requestbody='{"cachename":"sales"}' li_rc = lhc_client.sendrequest( "Post", "http://172.25.100.32:5000/api/Application/AddTransactionMapping/salesdemo_cloud/sqlca1", ls_requestbody) if li_rc = 1 and lhc_client.getresponsestatuscode( ) = 200 then lhc_client.getresponsebody(ls_body) end if
When successful, it returns the response status code 200 and the following response body:
When failed, it returns 400 (bad request), 401 (unauthorized), or 500 (server error).
{ "isSucceeded": true, "errorMessage": "string" }
Edits a transaction-to-cache mapping.
Syntax: POST /api/Application/EditTransactionMapping/{appName}/{transName}
{appName} indicates the application name, for example, salesdemo_cloud.
{transName} indicates the transaction object to be edited, for example, sqlca1.
PowerScript code example:
Integer li_rc String ls_body , ls_requestbody httpclient lhc_client lhc_client = create httpclient lhc_client.setrequestheader("Content-Type", "application/json;charset=UTF-8",true) ls_requestbody='{"cachename":"salestest"}' li_rc = lhc_client.sendrequest( "Post", "http://172.25.100.32:5000/api/Application/EditTransactionMapping/salesdemo_cloud/sqlca1", ls_requestbody) if li_rc = 1 and lhc_client.getresponsestatuscode( ) = 200 then lhc_client.getrequestbody(ls_body) end if
When successful, it returns the response status code 200 and the following response body:
When failed, it returns 400 (bad request), 401 (unauthorized), or 500 (server error).
{ "isSucceeded": true, "errorMessage": "string" }
Removes a transaction-to-cache mapping.
Syntax: POST /api/Application/RemoveTransactionMapping/{appName}/{transName}
{appName} indicates the application name, for example, salesdemo_cloud.
{transName} indicates the transaction object to be removed, for example, sqlca1.
PowerScript code example:
Integer li_rc String ls_body httpclient lhc_client lhc_client = create httpclient lhc_client.setrequestheader("Content-Type", "application/json;charset=UTF-8",true) li_rc = lhc_client.sendrequest( "Post", "http://172.25.100.32:5000/api/Application/RemoveTransactionMapping/salesdemo_cloud/sqlca1") if li_rc = 1 and lhc_client.getresponsestatuscode( ) = 200 then lhc_client.getrequestbody(ls_body) end if
When successful, it returns the response status code 200 and the following response body:
When failed, it returns 400 (bad request), 401 (unauthorized), or 500 (server error).
{ "isSucceeded": true, "errorMessage": "string" }