1.7 Remove a Role from a User

Revised: 18 June 2018

Using API

  1. Remove the (Buyer) role from a User in the HR system.

  2. The ERP Connector platform should trigger an API call to Coupa using GET API to query the User’s <id> that you need to update (based on “login”, for example, but any queryable field/tag can be used depending on business scenario).

  3. The ERP Connector platform should trigger a Coupa PUT API to update the status for the User in Coupa using the User's <id>.

  4. Ensure that you get a 200 API response and it is logged in your ERP Connector platform logging engine. If you get a different API response (for example, 400) error, the API error (returned on API response <errors><error> tag(s)) must be logged in the ERP Connector platform logging engine and a notification must be sent to the relevant person to investigate.

  5. Validate that the User in Coupa has the (Buyer) role removed.

Sample API Calls

In this example, a User is queried based on the User's “login” name (USER_TEST); then the API response Coupa user <id> is used to update the Coupa User's status to have the (Buyer) role removed.

Basic GET

https://<instance_url>/api/users?login=USER_TEST

The return payload has the Coupa user <id> (277) and all the roles the User already has.

Remove a role

Removing a role is a two-step process where you first remove all the roles from the user and then put back the desired roles

1. PUT the following payload to the desired user (for example  https://<instance_url>/api/users/277)

<?xml version="1.0" encoding="UTF-8"?>
<user>
	<roles>
	</roles>
</user>

 2. PUT the role(s) you want to add back to the user with a payload like this:

<?xml version="1.0" encoding="UTF-8"?>
<user>
	<roles>
		<role>
			<name>role name</name>
		</role>
	</roles>
</user>

See Add a Role to a User for more info.

Using CSV

See Add a Role to a User, but in the CSV file, list the role(s) that the User should have.

Remove all roles from a User by adding --NULL-- to the User Role Names field.

The CSV flat file upload is monitored in Coupa at https://<instance>/data_sources. Coupa sends a notification to Coupa Admin on an upload failure, and Coupa Admin needs to investigate further.