Import Policies File

post

/mobile/tools/1.0/policies/import

Imports the environment policies in the uploaded file.

Request

Supported Media Types
  • multipart/form-data
Form Parameters
desc
Type: string
The description of the policies that are in the file.
file
Type: file
Required: true
The file with the environment policies to upload.
overwrite
Type: boolean
Set to `true` to overwrite any existing policy of the same name. When this attribute is set to `false`, a policy in the uploaded file is ignored if that policy already exists.
purge
Type: boolean
Set to `true` to delete all existing environment policies before upload.

Response

Supported Media Types
  • application/json
200 Response
The upload was successful. The validation report was returned in the response.
Body
The result of validation of the properties file with policies.
Root Schema : policyValidationReport
Type: object
The result of validation of the properties file with policies.
Nested Schema : validationResults
Type: array
Minimum Number of Items: 0
400 Response
The properties file was either missing, empty, or corrupted, or it had an invalid format. The validation report might be returned in the response.
Body
Root Schema : error
Type: object
Nested Schema : errorDetails
Type: object

Examples

The following example shows how to upload a policies file using cURL. For more information about cURL, see Use cURL.

curl -i -X POST --form desc="version 5.0" --form file=@policies.properties -H "Authorization: Bearer $TOKEN" "$BASE_URL/mobile/tools/1.0/policies/import"

Example of File to Upload

The file must be in the properties format, which is a list of key/value pairs. You typically use an exported policies file as the template for this file, as shown in this example:

# ---------------------------------------------------------
# MCS Policies.
# ---------------------------------------------------------
# ! DO NOT EDIT THE HEADER !
# Snapshot from: instance1
# System version: 17.3.1.0.0.170706.0620
# Data format: 2
# ---------------------------------------------------------
*.*.Admin_DcsConfig={}
*.*.Admin_FeatureConfiguration={ "DCS"\: true }
*.*.Asset_AllowPurge=ALL
*.*.Asset_AllowTrash=ALL
*.*.Asset_AllowUntrash=ALL
*.*.Asset_DefaultInitialVersion=1.0
...

Example of Response Header

The following shows an example of the response headers:

200 OK
Date: Wed, 28 Jun 2017 20:00:11 GMT
Content-length: 37
Content-type: application/json

Example of Response Body

The following example shows the contents of the response body in JSON format:

{"valid":true,"validationResults":[]}