Skip to main content

POST /files/compliancePolicies?action=import

Use this method to import a zip file containing firmware-compliance policies into Lenovo XClarity Administrator.

A job is created to import the compliance policy. Use the GET /tasks/{job_list} (where {job_id} is the job ID) to retrieve the overall job status. If a job was not successfully started, refer to the response code and response body for details.

Note
A compliance policy that includes update packages might take a longer time to import.

Authentication

Authentication with username and password is required.

Request URL

POST https://{management_server_IP}/files/compliancePolicies?action=import

Query parameters

ParametersRequired / OptionalDescription
action=importRequiredImports firmware-compliance policies
The following example imports a compliance policy (with or without update packages)
POST https://192.0.2.0/files/compliancePolicies?action=import

Request body

Use the "multipart/form-data" media type to import the update package. Use the attributes in the following table as the multipart name in the body. For more information about the multipart/form-data media type, see Returning Values from Forms: multipart/form-data webpage.

The following example imports a zip file containing firmware-compliance policies.

HTTP Header
   Content-Type: multipart/form-data; boundary=AaB03x
Request body
   --AaB03x
Content-Disposition: form-data; name="uploadedfiles[]"; filename="policies2018103122275762.zip"
Content-Type: application/x-zip-compressed

--AaB03x
Content-Disposition: form-data; name="uploadedfiles[]"; filename="policies2018102523335745.zip"
Content-Type: application/x-zip-compressed

--AaB03x--

Response codes

CodeDescriptionComments
200OKThe request completed successfully.
400Bad RequestA query parameter or request attribute is missing or not valid, or the operation is not supported. A descriptive error message is returned in the response body.
403ForbiddenThe orchestrator server was prevented from fulfilling the request. A descriptive error message is returned in the response body. Ensure that you have privileges to perform the request.
404Not foundA specified resource cannot be found. A descriptive error message is returned in the response body.
409ConflictThere is a conflict with the current state of the resource. A descriptive error message is returned in the response body.
413Request Entity Too LargeClients might impose limitations on the length of the request URI, and the request URI is too long to be handled. A descriptive error message is returned in the response body.
500Internal Server ErrorAn internal error occurred. A descriptive error message is returned in the response body.

Response body

AttributesTypeDescription
jobidIntegerJob ID
statusStringImport status. This can be one of the following values.
  • success. The request completed successfully.
  • error. The request failed. A descriptive error message is returned.
errorMsgObjectInformation about firmware-compliance policy files that are not valid
 resultStringResults of the request. This can be one of the following values.
  • success. The request completed successfully.
  • failed. The request failed. A descriptive error message was returned.
 messagesArray of objectsInformation about one or more messages
  idStringMessage identifier of a returned message
  textStringMessage text associated with the message identifier
  explanationStringAdditional information to clarify the reason for the message
  recoveryArray of objectsRecovery information
   textStringUser actions that can be taken to recover from the event
popMsgObjectInformation about firmware-compliance policy files that exist on the management server
 resultStringResults of the request. This can be one of the following values.
  • success. The request completed successfully.
  • failed. The request failed. A descriptive error message was returned.
 messagesArray of objectsInformation about one or more messages
  idStringMessage identifier of a returned message
  textStringMessage text associated with the message identifier
  explanationStringAdditional information to clarify the reason for the message
  recoveryArray of objectsRecovery information
   textStringUser actions that can be taken to recover from the event
The following example is returned if the request is successful.
{
"jobid": 127,
"status": "success",
"errorMsg": {
"result": "major",
"messages": [{
"id": "FQXHMUP3033L",
"text": "Some files failed to import and are discarded.",
"explanation": "The following files are invalid and have been discarded: TestB.xml.",
"recovery": {
"text": "Please check the contents of files. Ensure that the uploaded files include
the correct .xml file."
}
}]
},
"popMsg": {
"result": "warning",
"messages": [{
"id": "FQXHMUP3032F",
"text": "Some files failed to import and are discarded.",
"explanation": "The following policy files already exist on system and have been
discarded: DEFAULT-2015-04-25.xml.",
"recovery": {
"text": "Rename or delete the existing compliance policy in the Compliance Policy
page, and retry the import."
}
}]
},
"successMsg": {
"result": "informational",
"messages": [{
"id": "FQXHMUP3030I",
"text": "Policy import completed successfully."
}]
}
}