PATCHing job user roles

Use the following endpoint to PATCH the role assignment for a job:

  • PATCH /job/v1/jobs/{jobId}/user-roles

You can use the PATCH endpoint to add or remove multiple role assignments in one call.

PATCHes in Cloud API are destructive, not additive. When you PATCH the roles array, the new content replaces the previous content entirely.

If you want to only add user role assignments to a job, the PATCH must contain all current members of the roles array as well as the new one.

  • To add multiple role assignments or reassignments, add multiple new entries to the roles array.
  • To remove role assignments, omit those entries from the roles array.
  • If there are assignments you do not want to change, you must also include those assignments in the roles array.

For example, suppose job pc:9 has already assigned the roles of Creator and Underwriter to Alice Applegate (pc:8) from the Los Angeles Branch UW group (pc:55) and the role of Customer Rep to Chris Clark (pc:303) from the Los Angeles Branch UW group (pc:55). The following PATCH does the following:

  • Adds the role of Auditor to Betty Baker (pc:220) from Eastern Region Underwriting (pc:1117).
  • Unassigns the role of Customer Rep. (This is done by omitting it from the roles array.)
  • Makes no changes to the Creator or Underwriter roles. (They are included in the roles array with their original data.)
PATCH /job/v1/jobs/pc:9/user-roles

{
    "data": {
        "attributes": {
          "group": "pc:1117",
          "role": {
            "code": "Auditor"
          },
          "user": "pc:220"
        },
        {
          "group": "pc:55",
          "role": {
            "code": "Creator"
          },
          "user": "pc:8"
        },
        {
          "group": "pc:55",
          "role": {
            "code": "Underwriter"
          },
          "user": "pc:8"
        }
    }
}