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.true
- purge
-
Type:
boolean
Set to `true` to delete all existing environment policies before upload.false
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.
- valid
-
Type:
boolean
Required:true
- validationResults
-
Type:
array
validationResultsAdditional Properties Allowed:Minimum Number of Items:0
Nested Schema : validationResults
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
- detail
-
Type:
string
Required:true
Message that provides the error details. - o:ecid
-
Type:
string
Required:true
Execution context ID, which is a unique identifier to correlate events or requests that are associated with the same transaction across several components. - o:errorCode
-
Type:
string
Required:true
The service's error code. - o:errorDetails
-
Type:
object
errorDetailsAdditional Properties Allowed: - o:errorPath
-
Type:
string
Required:true
The relative point in the API path where the error occurred. - status
-
Type:
integer
(int64
)Required:true
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details. - title
-
Type:
string
Required:true
Summary of the problem. - type
-
Type:
string
Required:true
The URI to the link that provides details about the HTTP status code.
Nested Schema : errorDetails
Type:
object
- detail
-
Type:
string
Required:true
- o:errorDetails
-
Type:
object
errorDetailsAdditional Properties Allowed: - title
-
Type:
string
Required:true
Summary of the problem. - type
-
Type:
string
Required:true
The URI to the link that provides details about the HTTP status code.
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":[]}