AddOne

Adds a cache.

Syntax: POST /api/Connection/AddOne/{cacheGroup}

{cacheGroup} indicates the cache group where the cache will be added, for example, Default.

PowerScript code example:

For details about the parameters in the JSON string, view here.

Integer li_rc
String ls_body , ls_json
httpclient  lhc_client
lhc_client = create httpclient

lhc_client.setrequestheader("Content-Type", "application/json;charset=UTF-8",true)

ls_json='{"cachename":"C1","configuration":{ "ConnectionType":0,"host":"172.168.13.1","port":1433,"userid":"sa","password":"sqltest","database":"appeonunittest","enablepooling":1,"minpoolsize":0,"maxpoolsize":100,"connectiontimeout":30,"commandtimeout":60,"DynamicConnection":0,"otheroptions":"","connectionlifetime":30,"securityOptions":"encrypt=false"}}'

li_rc  = lhc_client.sendrequest( "Post", "http://172.25.100.32:5000/api/Connection/AddOne/Default", ls_json)
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"
}