Managing Client Log Policies¶
Defining Client Log Policies¶
This document describes how to interact with client log policies via the mobile services REST API. Log policies control if clients of a given application are allowed to upload logs to mobile services.
Retrieving Client Log Policies¶
curl -s -u {trialuser}:{password} \
-X GET "https://hcpms-{trialuser}.hanatrial.ondemand.com/mobileservices/origin/hcpms/clientlogs/v1/admin/ApplicationPolicySet('com.sap.example')"
The server should reply with HTTP/1.1 200 OK
and a response body similar to the following:
{
"@odata.context": "$metadata#ApplicationPolicySet/$entity",
"ApplicationId": "com.sap.example",
"LogUploadEnabled": false
}
Updating Client Log Policies¶
curl -s -u {trialuser}:{password} \
-H "Content-Type: application/json; charset=utf-8" \
-X PATCH "https://hcpms-{trialuser}.hanatrial.ondemand.com/mobileservices/origin/hcpms/clientlogs/v1/admin/ApplicationPolicySet('com.sap.example')" \
--data '{
"LogUploadEnabled": true
}'
The server should reply with HTTP/1.1 204 No Content
if the queried resource could be updated.
Deleting Client Log Policies¶
You may delete existing client policies using the following request:
curl -s -u {trialuser}:{password} \
-X GET "https://hcpms-{trialuser}.hanatrial.ondemand.com/mobileservices/origin/hcpms/clientlogs/v1/admin/ApplicationPolicySet('com.sap.example')"
The server should reply with HTTP/1.1 204 No Content
if the queried resource existed.
Creating Client Log Policies¶
By default, mobile services creates logging policies for all newly created apps. To create a previously deleted policy, run the following request:
curl -s -u {trialuser}:{password} \
-H "Content-Type: application/json; charset=utf-8" \
-X POST "https://hcpms-{trialuser}.hanatrial.ondemand.com/mobileservices/origin/hcpms/clientlogs/v1/admin/ApplicationPolicySet" \
--data '{
"ApplicationId": "com.sap.example",
"LogUploadEnabled": true
}'
The server should reply with HTTP/1.1 201 Created
and the following response body if the specified policy didn't
already exist:
{
"@odata.context": "$metadata#ApplicationPolicySet/$entity",
"ApplicationId": "com.sap.example",
"LogUploadEnabled": true
}