# Update Product Policy

Updates a policy for a given product

Endpoint: PUT /api/v2.0/products/{productToken}/policies/{policyUuid}
Version: 2.0
Security: bearer-key

## Path parameters:

  - `productToken` (string, required)
    product UUID (by running Entities - Organization > Get Organization Products) or Product Token (from the Mend SCA App: Integrate tab > Product Token).

  - `policyUuid` (string, required)
    Policy UUID (by running Policies - Organization and run Get Organization Policies, or the equivalent for Product or Project.)

## Request fields (application/json):

  - `name` (string, required)
    Example: "License Policy"

  - `filter` (object, required) — one of:
    - GAV_REGEX:
      - `type` (string)
      - `groupIdRegex` (string)
        Example: "/**"
      - `artifactIdRegex` (string)
        Example: "/**"
      - `versionRegex` (string)
        Example: "/**"
    - LIBRARY_REQUEST_HISTORY:
      - `type` (string)
      - `libraryRequestHistory` (string, required)
        Enum: "APPROVED_AT_LEAST_ONCE", "APPROVED_AT_LEAST_ONCE_OR_PENDING", "REJECTED_AT_LEAST_ONCE", "REJECTED_AT_LEAST_ONCE_OR_PENDING", "PENDING"
    - LIBRARY_STALENESS:
      - `type` (string)
      - `monthsBack` (integer, required)
        Example: 36
    - LICENSE:
      - `type` (string)
      - `licenses` (array, required)
      - `licenses.uuid` (string)
        Example: "123e4567-e89b-12d3-a456-426655440000"
      - `licenses.name` (string, required)
        Example: "MIT"
      - `inclusive` (boolean)
        Trigger only when ALL licenses of the library are matched
    - PRIMARY_ATTRIBUTE_VALUE:
      - `type` (string)
      - `attributeValue` (string, required)
        Example: "value"
    - PRODUCT:
      - `type` (string)
      - `productToken` (string, required)
        Example: "123e4567-e89b-12d3-a456-426655440000"
      - `productName` (string)
        product UUID (by running Entities - Organization > Get Organization Products) or Product Token (from the Mend SCA App: Integrate tab > Product Token).
        Example: "Product A"
    - ReferenceNameRequiredException:
      - `cause` (object)
      - `cause.stackTrace` (array)
      - `cause.stackTrace.classLoaderName` (string)
      - `cause.stackTrace.moduleName` (string)
      - `cause.stackTrace.moduleVersion` (string)
      - `cause.stackTrace.methodName` (string)
      - `cause.stackTrace.fileName` (string)
      - `cause.stackTrace.lineNumber` (integer)
      - `cause.stackTrace.className` (string)
      - `cause.stackTrace.nativeMethod` (boolean)
      - `cause.message` (string)
      - `cause.suppressed` (array)
      - `cause.suppressed.stackTrace` (array)
      - `cause.suppressed.stackTrace.classLoaderName` (string)
      - `cause.suppressed.stackTrace.moduleName` (string)
      - `cause.suppressed.stackTrace.moduleVersion` (string)
      - `cause.suppressed.stackTrace.methodName` (string)
      - `cause.suppressed.stackTrace.fileName` (string)
      - `cause.suppressed.stackTrace.lineNumber` (integer)
      - `cause.suppressed.stackTrace.className` (string)
      - `cause.suppressed.stackTrace.nativeMethod` (boolean)
      - `cause.suppressed.message` (string)
      - `cause.suppressed.localizedMessage` (string)
      - `cause.localizedMessage` (string)
      - `stackTrace` (array)
      - `stackTrace.classLoaderName` (string)
      - `stackTrace.moduleName` (string)
      - `stackTrace.moduleVersion` (string)
      - `stackTrace.methodName` (string)
      - `stackTrace.fileName` (string)
      - `stackTrace.lineNumber` (integer)
      - `stackTrace.className` (string)
      - `stackTrace.nativeMethod` (boolean)
      - `requestId` (string)
      - `errorCode` (string)
      - `errorType` (string)
        Enum: "Client", "Service", "Unknown"
      - `errorMessage` (string)
      - `statusCode` (integer)
      - `serviceName` (string)
      - `httpHeaders` (object)
      - `rawResponse` (array)
      - `rawResponseContent` (string)
      - `message` (string)
      - `retryable` (boolean)
      - `suppressed` (array)
      - `suppressed.stackTrace` (array)
      - `suppressed.stackTrace.classLoaderName` (string)
      - `suppressed.stackTrace.moduleName` (string)
      - `suppressed.stackTrace.moduleVersion` (string)
      - `suppressed.stackTrace.methodName` (string)
      - `suppressed.stackTrace.fileName` (string)
      - `suppressed.stackTrace.lineNumber` (integer)
      - `suppressed.stackTrace.className` (string)
      - `suppressed.stackTrace.nativeMethod` (boolean)
      - `suppressed.message` (string)
      - `suppressed.localizedMessage` (string)
      - `localizedMessage` (string)
    - EFFECTIVENESS:
      - `type` (string)
      - `shieldValue` (string, required)
        Enum: "RED", "YELLOW", "GREY", "NO_SHIELD", "GREEN"
    - VULNERABILITY_SCORE:
      - `type` (string)
      - `from` (number)
      - `to` (number)

  - `action` (any, required) — one of:
    - APPROVE:
      - `type` (string, required)
    - CONDITIONS:
      - `type` (string, required)
      - `approveWhenAllSatisfied` (boolean)
      - `rejectWhenOneRejected` (boolean)
      - `conditions` (array)
      - `conditions.duty` (string)
        Enum: "REQUESTER", "APPROVER"
      - `conditions.user` (object)
      - `conditions.user.uuid` (string, required)
        Example: "123e4567-e89b-12d3-a456-426655440000"
      - `conditions.user.name` (string)
        Example: "jon.smith"
      - `conditions.user.email` (string)
        Example: "jon.smith@mail.com"
      - `conditions.group` (object)
      - `conditions.group.uuid` (string, required)
        Example: "123e4567-e89b-12d3-a456-426655440000"
      - `conditions.group.name` (string)
        Example: "Group A"
      - `conditions.conditionText` (string, required)
        Example: "A reason for the condition"
      - `conditions.duePeriod` (integer, required)
        Example: 10
      - `failPolicyCheck` (boolean)
    - CREATE_ISSUE:
      - `type` (string, required)
      - `failPolicyCheck` (boolean)
      - `issueTrackerType` (string, required)
        Enum: "COMMON_ISSUE_TRACKER"
    - REASSIGN:
      - `type` (string, required)
      - `user` (object)
      - `user.uuid` (string, required)
        Example: "123e4567-e89b-12d3-a456-426655440000"
      - `user.name` (string)
        Example: "jon.smith"
      - `user.email` (string)
        Example: "jon.smith@mail.com"
      - `group` (object)
      - `group.uuid` (string, required)
        Example: "123e4567-e89b-12d3-a456-426655440000"
      - `group.name` (string)
        Example: "Group A"
      - `failPolicyCheck` (boolean)
    - REJECT:
      - `type` (string, required)

  - `enabled` (boolean)

## Response 200 fields (application/json):

  - `supportToken` (string)
    Example: "1171c60d"

  - `retVal` (object)
    Policies are checked by order of priority; note that 1 is the lowest priority

  - `retVal.uuid` (string)
    Example: "123e4567-e89b-12d3-a456-426655440000"

  - `retVal.name` (string)
    Example: "A Policy"

  - `retVal.owner` (object)

  - `retVal.owner.uuid` (string, required)
    Example: "123e4567-e89b-12d3-a456-426655440000"

  - `retVal.owner.name` (string)
    Example: "Jon Smith"

  - `retVal.owner.email` (string)
    Example: "jon.smith@mail.com"

  - `retVal.owner.userType` (string)
    Enum: "REGULAR", "SERVICE", "SCAN_SUMMARY_RECEIVER"

  - `retVal.owner.accountStatus` (string)
    Enum: "ACTIVE", "INACTIVE", "LOCKOUT"

  - `retVal.createdAt` (string)

  - `retVal.priority` (integer)
    1 is the lowest priority
    Example: 1

  - `retVal.filter` (object)

  - `retVal.filter.type` (string)

  - `retVal.action` (any) — one of:
    - APPROVE:
      - `type` (string, required)
    - CONDITIONS:
      - `type` (string, required)
      - `approveWhenAllSatisfied` (boolean)
      - `rejectWhenOneRejected` (boolean)
      - `conditions` (array)
      - `conditions.duty` (string)
        Enum: same as `conditions.duty` in "CONDITIONS" (2 values)
      - `conditions.user` (object)
      - `conditions.user.uuid` (string, required)
        Example: "123e4567-e89b-12d3-a456-426655440000"
      - `conditions.user.name` (string)
        Example: "jon.smith"
      - `conditions.user.email` (string)
        Example: "jon.smith@mail.com"
      - `conditions.group` (object)
      - `conditions.group.uuid` (string, required)
        Example: "123e4567-e89b-12d3-a456-426655440000"
      - `conditions.group.name` (string)
        Example: "Group A"
      - `conditions.conditionText` (string, required)
        Example: "A reason for the condition"
      - `conditions.duePeriod` (integer, required)
        Example: 10
      - `failPolicyCheck` (boolean)
    - CREATE_ISSUE:
      - `type` (string, required)
      - `failPolicyCheck` (boolean)
      - `issueTrackerType` (string, required)
        Enum: same as `issueTrackerType` in "CREATE_ISSUE" (1 values)
    - REASSIGN:
      - `type` (string, required)
      - `user` (object)
      - `user.uuid` (string, required)
        Example: "123e4567-e89b-12d3-a456-426655440000"
      - `user.name` (string)
        Example: "jon.smith"
      - `user.email` (string)
        Example: "jon.smith@mail.com"
      - `group` (object)
      - `group.uuid` (string, required)
        Example: "123e4567-e89b-12d3-a456-426655440000"
      - `group.name` (string)
        Example: "Group A"
      - `failPolicyCheck` (boolean)
    - REJECT:
      - `type` (string, required)

  - `retVal.context` (object)

  - `retVal.context.uuid` (string)
    Example: "123e4567-e89b-12d3-a456-426655440000"

  - `retVal.context.name` (string)
    Example: "Context A"

  - `retVal.context.contextType` (string)
    Enum: "ORGS", "PRODUCTS", "PROJECTS"

  - `retVal.enabled` (boolean)

  - `retVal.modifiedAt` (string)

  - `retVal.modifiedBy` (string)
    Example: "jon.smith@mail.com"

  - `retVal.aggregatedPriority` (integer)

## Response 400 fields (*/*):

  - `supportToken` (string)
    Example: "1171c60d"


