Guides

This document provides general guides and tutorials for common operations relating to the SCIM 2.0 API for Work Accounts. This content describes multi-step operations or administrative tasks. For examples of singular requests, see the Examples page.


SCIM Guides

How to Assign Managers to Users

This guide outlines how to assign managers to new users or to existing users.


All Guides


How to Assign Managers to Users

Step 1: Identify the Manager

Identify the manager's Work Accounts ID. If the ID is unknown, perform a GET User Request using the user's username or externalId to retrieve the id.

Request Path
GET /Users?filter=userName%20eq%20%22`{USERNAME}`%22 HTTP/1.1
Host: scim.workplace.com
Authorization: Bearer {your access token}
User-Agent: {your user agent}

Response

200: Success

Returns a JSON representation of the User's account. Record the value of the id property.

Example
Request Path
GET /Users?filter=userName%20eq%20%22`b.wayne`%22

Response

{
    "userName":"b.wayne",
    "id":"2567" 
}

Step 2A: Assign Manager to a New User

Perform a Create User Request and input the manager's id in the manager field. If you're assigning the manager to an existing user, skip to Step 2B.

Request Path
POST /Users HTTP/1.1
Host: scim.workplace.com
Authorization: Bearer {your access token} 
User-Agent: {your user agent}
Request Body
{
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0/User",
      	"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",
    ],
    "userName":"{STRING}",
    "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
    	
      "manager":{
      	"value":"{STRING}",
      }
    }
}
Response

201: Created

Returns a JSON representation of the user account with the manager set to the specified ID.

Example
Request Path
POST https://scim.workplace.com/Users
Request Body
{
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0/User",
      	"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",
    ],
    "userName":"d.grayson",
    "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
      	"manager":{
      		"value":"2567",
      	}
    }
}
Response
{
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0/User",
      	"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",
    ],
    "userName":"d.grayson",
    "id":"4215",
    "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
      	"manager":{
      		"value":"2567",
      	}
    }
}

Step 2B: Assign Manager to an Existing User

Identify the existing User's Work Accounts ID. If the ID is unknown, perform a GET User Request using the user's username or externalId to retrieve the id.

Perform a PatchOp Request to update the User's manager field.

Request Path
PATCH /Users/`{WORK ACCOUNTS ID}`/ HTTP/1.1
Host: scim.workplace.com
Authorization: Bearer {your access token} 
User-Agent: {your user agent}
Request Body
{
  "schemas":[
  	"urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations":[{
  	"op": "replace",
  	"path": "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:manager",
  	"value":{
   		"value":"{STRING}"
   	}
  }]
}

Response

200: Success

Returns a JSON representation of the user account with the manager set to the specified ID.

Example
Request Path
PATCH /Users/616
Request Body
{
  "schemas":[
  	"urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations":[{
  	"op": "replace",
  	"path": "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:manager",
  	"value":{
   		"value":"2567"
   	}
  }]
}
Response
{
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0/User",
      	"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",
    ],
    "userName":"m.morales",
    "id":"616",
    "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
      	"manager":{
      		"value":"2567",
      	}
    }
}