Create Approval Policy

Details

URI /organization/<organization_id>/approvalPolicy
Method POST
Parameters

userIdentifier=<user_id>
    Required; the user ID you want to use as credentials for this API call. See Get userIdentifier for the steps required to get the userIdentifier value.

Returns 200 - Ok
401 - Not authorized
404 - Object not found
500 - Server exception

The types of approval policies supported are: NamedApproverApprovalTemplate, NamedGroupApprovalTemplate, UserContextApprovalTemplate, and DelegatedApprovalTemplate.

In NamedApproverApprovalTemplate request body:

  • displayName is required.
  • approver is optional.
  • minApprovalRequired is optional. If there are no approver(s), the default value is 0. if there are approver(s), the default will be 1 and the value cannot exceed the number of approvers.
  • automaticApproval is optional. The default value is false. If it is true, the following are the valid values:
    • automaticPeriodDuration (in days) is optional. The default value is 0 and the valid values range from 0 to 365
    • automaticApprovalDecision is required; valid value is APPROVED or REJECTED.

Example request body:

<NamedApproverApprovalTemplate>
  <displayName>Name Ex Template 03</displayName>
  <approver><userName>consumer</userName></approver>
  ...
  <approver><userName>consumer04</userName></approver>
  <minApprovalRequired>1</minApprovalRequired>
  <automaticApproval>true</automaticApproval>
  <automaticPeriodDuration>12</automaticPeriodDuration>
  <automaticApprovalDecision>
    <name>REJECTED</name>
  </automaticApprovalDecision>
</NamedApproverApprovalTemplate>

In NamedGroupApprovalTemplate request body:

  • displayName is required.
  • group's distinguishedName is required.
  • minApprovalRequired is optional and default value is 1 and the value cannot exceed the number of users in the group.
  • automaticApproval is optional.The default value is false. If it is true, the following are the valid values:
    •  automaticPeriodDuration (in days) is optional. The default value is 0 and the valid values range from 0 to 365
    • automaticApprovalDecision is required; valid value is APPROVED, or REJECTED.

Example request body:

<NamedGroupApprovalTemplate>
  <displayName>Name Group Template 01</displayName>
  <group>
  	<distinguishedName>
  		cn=ServiceConsumer,ou=ConsumerGroup,ou=CSAGroups
  	</distinguishedName>
  </group>
  <minApprovalRequired>0</minApprovalRequired>
  <automaticApproval>true</automaticApproval>
  <automaticApprovalDecision><automaticApprovalDecision>
    <name>REJECTED</name>
  </automaticApprovalDecision>
</NamedGroupApprovalTemplate>

In UserContextApprovalTemplate request body:

  • displayName is required.
  • automaticApproval is optional. The default value is false. If it is true, the following are the valid values:
    • automaticPeriodDuration (in days) is optional. The default value is 0 and the valid values range from 0 to 365
    • automaticApprovalDecision is required; valid value is APPROVED, or REJECTED.

Example request body:

<UserContextApprovalTemplate>
  <displayName>User ContextTemplate 01</displayName>
  <automaticApproval>true</automaticApproval>
  <automaticPeriodDuration>7</automaticPeriodDuration>
  <automaticApprovalDecision>
    <name>APPROVED</name>
  </automaticApprovalDecision>
</UserContextApprovalTemplate>

In DelegatedApprovalTemplate request body:

  • displayName is required.
  • processDefinition is required, ID is needed.
  • automaticApproval is optional. The default value is false. If it is true, the following are the valid values:
    • automaticPeriodDuration (in days) is optional. The default value is 0 and the valid values range from 0 to 365
    • automaticApprovalDecision is required; valid value is APPROVED, or REJECTED.

Example request body:

<DelegatedApprovalTemplate>
  <displayName>Name Ex Template 03</displayName>
  <processDefinition>
    <id>90d96507362a000a01362a0048bc00ad</id>
  </processDefinition>
  <automaticApproval>true</automaticApproval>
  <automaticPeriodDuration>30</automaticPeriodDuration>
  <automaticApprovalDecision>
    <name>REJECTED</name>/
  </automaticApprovalDecision>
</DelegatedApprovalTemplate>

Example

The following URL is sent to create an approval policy with two named approvers:

https://<host>:<port>/csa/rest/organization/8a81818f3d1421e7013d1423635a0003/ approvalPolicy?userIdentifier=90d96588360da0c701360da0f1d5f483

The following XML was sent in the request:

<NamedApproverApprovalTemplate>
  <displayName>My-New-Approval-Template</displayName>
  <approver><userName>ProjectManager</userName></approver>
  <approver><userName>BudgetManager</userName></approver>
  <minApprovalRequired>2</minApprovalRequired>
  <automaticApproval>true</automaticApproval>
  <automaticPeriodDuration>14</automaticPeriodDuration>
  <automaticApprovalDecision>
    <name>APPROVED</name>
  </automaticApprovalDecision>
</NamedApproverApprovalTemplate>

The following XML is returned:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<NamedApproverApprovalTemplate>
  <id>8a81818f3d1437e2013d17f249c30a0c</id>
  <objectId>8a81818f3d1437e2013d17f249c30a0c</objectId>
  <createdOn>2013-02-26T11:19:47.397-08:00</createdOn>
  <updatedOn>2013-02-26T11:19:47.440-08:00</updatedOn>
  <createdBy> ... </createdBy>
  <updatedBy> ... </updatedBy>
  <isCriticalSystemObject>false</isCriticalSystemObject>
  <name>
    My-New-Approval-Template_February 26, 2013 7:19:47 PM UTC
  </name>
  <displayName>My-New-Approval-Template</displayName>
  <state> ... </state>
  <artifactType>
    <id>90d96588360da0c701360da0eef20027</id>
    <objectId>90d96588360da0c701360da0eef20027</objectId>
    <createdOn>2013-02-25T17:32:55.667-08:00</createdOn>
    <isCriticalSystemObject>true</isCriticalSystemObject>
    <description>Approval Template</description>
    ...
  </artifactType>
  <ownedBy> ... </ownedBy>
  <disabled>false</disabled>
  <automaticApproval>true</automaticApproval>
  <automaticPeriodDuration>14</automaticPeriodDuration>
  <minApprovalRequired>2</minApprovalRequired>
  <approvalType>
    <id>90d96588360da0c701360da0f0b00093</id>
    <objectId>90d96588360da0c701360da0f0b00093</objectId>
    <createdOn>2013-02-25T17:32:55.620-08:00</createdOn>
    <isCriticalSystemObject>true</isCriticalSystemObject>
    <description>Named Approver Template</description>
    ...
  </approvalType>
  <automaticApprovalDecision> ... </automaticApprovalDecision>
  <approver>
    <id>8a81818f3d1437e2013d17eec74408d8</id>
    ...
    <userName>BudgetManager</userName>
    ...
  </approver>
  <approver>
    <id>8a81818f3d1437e2013d177b13f107dd</id>
    ...
    <userName>ProjectManager</userName>
    ...
  </approver>
</NamedApproverApprovalTemplate>