POST /files/compliancePolicies?action=import

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

Note: This API requires Lenovo XClarity Administrator v2.3.0 or later.

Authentication

Authentication with user name and password is required.

Request URL

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

Query parameters

Parameters Required / Optional Description
action=import Required Imports firmware-compliance policies

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

Code Description Comments
200 OK The request completed successfully.
400 Bad Request A 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.
403 Forbidden The 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.
404 Not found A specified resource cannot be found. A descriptive error message is returned in the response body.
409 Conflict There is a conflict with the current state of the resource. A descriptive error message is returned in the response body.
413 Request Entity Too Large Clients 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.
500 Internal Server Error An internal error occurred. A descriptive error message is returned in the response body.

Response body

Attributes Type Description
status String Import status. This can be one of the following values.
  • success. The request completed successfully.
  • error. The request failed. A descriptive error message is returned.
errorMsg Object Information about firmware-compliance policy files that are not valid
  result String Results 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.
  messages Array of objects Information about one or more messages
    id String Message identifier of a returned message
    text String Message text associated with the message identifier
    explanation String Additional information to clarify the reason for the message
    recovery Array of objects Recovery information
      text String User actions that can be taken to recover from the event
popMsg Object Information about firmware-compliance policy files that exist on the management server
  result String Results 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.
  messages Array of objects Information about one or more messages
    id String Message identifier of a returned message
    text String Message text associated with the message identifier
    explanation String Additional information to clarify the reason for the message
    recovery Array of objects Recovery information
      text String User actions that can be taken to recover from the event
The following example is returned if the request is successful.
{
   "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."
      }]
   }
}