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(optional): string
The description of the policies that are in the file.
-
file: file
The file with the environment policies to upload.
-
overwrite(optional): 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.Default Value:
true
-
purge(optional): boolean
Set to `true` to delete all existing environment policies before upload.Default Value:
false
Response
Supported Media Types
- application/json
200 Response
The upload was successful. The validation report was returned in the response.
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.
Show Source
-
valid:
boolean
-
validationResults(optional):
array validationResults
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.
Root Schema : error
Type:
Show Source
object
-
detail:
string
Message that provides the error details.
-
o:ecid:
string
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:
string
The service's error code.
-
o:errorDetails(optional):
object errorDetails
-
o:errorPath:
string
The relative point in the API path where the error occurred.
-
status:
integer(int64)
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
Nested Schema : errorDetails
Type:
Show Source
object
-
detail:
string
-
o:errorDetails(optional):
object errorDetails
-
title:
string
Summary of the problem.
-
type:
string
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":[]}