Skip to main content

POST /compliancePolicies

Use this method to create, copy, or import a firmware-compliance policy in Lenovo XClarity Administrator.

Authentication

Authentication with username and password is required.

Request URL

POST https://{management_server_IP}/compliancePolicies

Query parameters

ParametersRequired / OptionalDescription
action={action}RequiredAction type. This can be one of the following values.
  • create. Add a compliance policy.
  • copy. Copy a compliance policy.
The following example creates a compliance policy.
POST https://192.0.2.0/compliancePolicies?action=create

Request body

Table 1. Create a compliance policy.
AttributesRequired / OptionalTypeDescription
policyRequiredObjectInformation about the compliance policy
 actionRequiredStringAction to take. This is always create.
 descriptionOptionalStringCompliance policy description
 detailsRequiredArray of objectsDetails about the compliance policy
  baseVersionRequiredStringFor CMMs or switches, this is the fix ID of the package. For servers, the following is returned.
xxxx_utl_uxsp_xxxxxx-1.00_xxxx_32-64
  componentsRequiredArray of objectsInformation about each firmware component
   isDefaultRequiredStringSpecifies if the component update is the default component (the latest component update). This can be one of the following values.
  • yes. This firmware component is the default.
  • no. This firmware component not is the default.
   nameRequiredStringComponent name
   ruleRequiredStringRule for raising a non-compliant alert. This can be one of the following values.
  • alertIfNotExactMatch. Show non-compliance when the installed version on device does not exactly match the compliance target.
  • alertIfDownlevel. Show non-compliance when the installed version on device is earlier than the compliance target.
  • noAlerting. Never show non-compliance.
   targetVersionRequiredStringFirmware level that is the baseline for the specified device type
   typeRequiredString(Servers only) Package type. This can be one of the following values.
  • IMM
  • IMM
  • UEFI
  • UEFI-Backup
  idRequiredStringSystem type used to identify the CMM. Internal use only
  isDefaultRequiredStringIndicates whether the update package is the default package (the latest package). This can be one of the following values.
  • yes. This is the default update package.
  • no. This is not the default update package.
  isDoNotUpdateRequiredStringIndicates whether the policy is set to do not update. +++This can be one of the following values.
  • yes. The policy is set to Do not update.
  • no. The policy is not set to Do not update.
  isUXSPRequiredStringIndicates whether this update package is a UXSP package. This can be one of the following values.
  • yes. This is a UXSP package.
  • no. This is not a UXSP package.
  ruleRequiredStringRule for raising a non-compliant alert. This can be one of the following values.
  • alertIfNotExactMatch. Show non-compliance when the installed version on device does not exactly match the compliance target.
  • alertIfDownlevel. Show non-compliance when the installed version on device is earlier than the compliance target.
  • noAlerting. Never show non-compliance.
  • custom. Follow the detailed rules of each firmware component.
  systemTypeRequiredStringType of device for which the policy applies
 filterTypeRequiredStringFilter type. This can be one of the following values.
  • all. All supported machine types

  • managed. Only managed machine types.

 nameRequiredStringCompliance policy name
 oldPolicyNameRequiredStringSpecify an empty value when creating a compliance policy
 updateRuleRequiredStringInternal use only
 userRequiredStringName of the user that requested to create the policy
The following example creates a new compliance policy when the query parameter ​action=create is specified.
{
"policy": {
"action": "create",
"description": "",
"details": [{
"baseVersion": "xxxx_utl_uxsp_xxxxxx-1.00_xxxx_32-64",
"components": [{
"name": "Integrated Management Module 2 (IMM2) Update (Standby)",
"rule": "alertIfDownlevel",
"type": "IMM-Backup",
"targetVersion": "DoNotUpdate_ibm_fw_imm2_1aoo81a-6.60_anyos_noarch",
"isDefault": "yes"
}],
"id": "8737",
"isDefault": "no",
"isDoNotUpdate": "yes",
"isUXSP": "no",
"rule": "custom",
"systemType": "8737",
}],
"filterType": "managed",
"name": "4234234234",
"oldPolicyName": ""
"updateRule": "",
"user": "USERID"
}
}
Table 2. Copy a compliance policy
AttributesRequired / OptionalTypeDescription
oldPolicyNameRequiredStringName of policy to be copied
prefixRequiredStringPrefix of copied policy name
userRequiredStringName of the user that requested to copy the policy
The following example copies an existing policy when the query parameter ​action=copy is specified.
{
"oldPolicyName": "test",
"user": "USERID",
"prefix": "Copy"
}

Response codes

CodeDescriptionComments
200OKThe request completed successfully.
307Temporary RedirectThe URL changed for this REST API. The response header returns the correct URL in the Location attribute.

The URL changed for this REST API when action=import is specified.

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.
409ConflictThere is a conflict with the current state of the resource. 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

Table 3. Create a compliance policy
AttributesTypeDescription
{message_attributes}variesStatus messages (see Status messages)

The result attribute can be one of the following values.

  • informational. The request completed successfully.
  • minor. The request failed with a minor issue.
  • major. The request failed with a major issue.
The following example is returned if the request is successful.
{
"result": "informational",
"messages": [{
"id": "FQXHM3006I",
"text": "Policy operation completed successfully."
}]
}
Table 4. Copy a compliance policy.

When the request is successful, the following attributes are returned in the response body. If the request fails, standard message attributes are returned (see Status messages), where the result attribute can be one of the following values: informational, minor, or major.

AttributesTypeDescription
descriptionStringCompliance policy description
filterTypeStringFilter type. This can be one of the following values.
  • all. All supported machine types
  • managed. Only managed machine types.
idStringCompliance policy ID
inUseStringIdentifies whether the compliance policy is in use. This can be one of the following values.
  • true. The compliance policy is in use.
  • false. The compliance policy is not in use.
lastActionStringLast action that was performed on the compliance policy. This can be one of the following values.
  • Predefined. The compliance policy is predefined.
  • Created by {user_name}. The user-defined compliance policy was created by the specified user.
  • Edited by {user_name}. The user-defined compliance policy was edited by the specified user.
lastModifiedStringTimestamp of the last change to the compliance policy
lastEditedStringTimestamp of the last change to the compliance policy
nameStringCompliance policy name
updateRuleStringInternal use only
userDefinedStringIdentifies whether the compliance policy is user-defined. This can be one of the following values.
  • yes. The compliance policy is user-defined.
  • no. The compliance policy is predefined.
The following example is returned if the request is successful.
{
"description": "",
"filterType": "all",
"id": "1624433666597",
"inUse": false,
"lastAction": "Created by USERID",
"lastEdited": "2021-06-23T07:34:26Z",
"lastModified": "This policy was created by USERID on 2021-06-23T07:34:26Z",
"name": "Copy1-test",
"updateRule": "",
"userDefined": "yes"
}
Table 5. Import a compliance policy.
AttributesTypeDescription
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
successMsgObjectInformation about firmware-compliance policy files that were imported successfully
 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.
{
"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."
}]
}
}