Edit this page on GitHub

Home > docs > api > Policy

Policy

Policies control various aspects of process execution.

The REST API provides support for working with policies:

Create or Update a Policy

Creates a new policy or updates an existing one. Requires administrator privileges.

  • URI /api/v2/policy
  • Method POST
  • Headers Authorization, Content-Type: application/json
  • Body
      {
        "name": "myPolicy",
        "parentId": "...",
        "rules": {
          ...policy document...      
        }
      }
    
    • name - the policy’s name;
    • parentId - optional, ID of a parent policy;
    • rules - the policy’s rules, see the Policies document.
  • Success response

      Content-Type: application/json
    
      {
        "result": "CREATED",
        "ok": true,
        "id": "..."
      }
    

Get a Policy

Returns an existing policy.

  • URI /api/v2/policy/${name}
  • Method GET
  • Headers Authorization
  • Body none
  • Success response
      Content-Type: application/json
    
      {
        "name": "myPolicy",
        "parentId": "...",
        "rules": {
          ...policy document...      
        }
      }
    

Remove a Policy

Deletes an existing policy.

  • URI /api/v2/policy/${name}
  • Method DELETE
  • Headers Authorization
  • Body none
  • Success response

      Content-Type: application/json
    
      {
        "result": "DELETED",
        "ok": true
      }
    

Links an existing policy to an organization, project or a specific user.

  • URI /api/v2/policy/${name}/link
  • Method PUT
  • Headers Authorization, Content-Type: application/json
  • Body
      {
        "orgName": "myOrg",
        "projectName": "myProject",
        "userName": "someUser"
      }
    

    All parameters are optional. If all parameters are omitted (or null) then the policy becomes a system-wide policy.

  • Success response

      Content-Type: application/json
    
      {
        "result": "UPDATED",
        "ok": true
      }
    

Unlinks an existing policy from an organization, project or a specific user.

  • URI /api/v2/policy/${name}/link?orgName=${orgName}&projectName=${projectName}&userName=${userName}
  • Query parameters All parameters are optional. If all parameters are omitted then the system link is removed.
  • Method DELETE
  • Headers Authorization, Content-Type: application/json
  • Body none
  • Success response

      Content-Type: application/json
    
      {
        "result": "DELETED",
        "ok": true
      }