1.2 Modify a User

Revised: 24 April 2017

Using API

  1. Change a User's details (last name and email address) in the HR system.
  2. The ERP Connector platform should trigger an API call to Coupa with the User 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 User in Coupa using the User <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's details are modified correctly in Coupa.

Sample API

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 with a new last name and email address. 

GET

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

Payload

<?xml version="1.0" encoding="UTF-8"?>
<users type="array">
  <user>
    <id type="integer">281</id>
    <created-at type="dateTime">2016-06-30T07:51:11Z</created-at>
    <updated-at type="dateTime">2016-07-14T07:53:55Z</updated-at>
    <login>USER_TEST</login>
    <email>user_test_new_email@coupa.com</email>
    <purchasing-user type="boolean">true</purchasing-user>
    <expense-user type="boolean">true</expense-user>
    <sourcing-user type="boolean">false</sourcing-user>
    <inventory-user type="boolean">false</inventory-user>
    <employee-number />
    <phone-work nil="true" />
    <phone-mobile nil="true" />
    <firstname>user</firstname>
    <lastname>test new lastname</lastname>
    <fullname>user test new lastname</fullname>
    <api-user type="boolean">false</api-user>
    <active type="boolean">true</active>
    <salesforce-id nil="true" />
    <account-security-type type="integer">0</account-security-type>
    <authentication-method type="symbol">coupa_credentials</authentication-method>
    <sso-identifier nil="true" />
    <default-locale>en</default-locale>
    <default-account nil="true" />
    <business-group-security-type type="integer">1</business-group-security-type>
    <edit-invoice-on-quick-entry type="boolean">false</edit-invoice-on-quick-entry>
    <avatar-thumb-url nil="true" />
    <mention-name>usertestnewlastname</mention-name>
    <test-cust-field>TEST_CUSTOM_FIELD</test-cust-field>
    <roles type="array" />
  </user>
</users>

Take the User's <id> form the response payload (<id>277</id>).

PUT

https://<instance_url>/api/users/277

Payload

<?xml version="1.0" encoding="UTF-8"?>
<user>
  <login>USER_TEST</login>
  <email>user_test_new_email@coupa.com</email>
  <firstname>USER</firstname>
  <lastname>TEST NEW LASTNAME</lastname>
  <fullname>USER TEST</fullname>
</user>

Using CSV

  1. Change a User's details (last name and email address) in the HR system.
  2. The ERP Connector platform generates a CSV flat file containing the changes that you want to see in Coupa.
  3. The ERP Connector platform places the CSV file to the /Incoming/Users folder on the Coupa sFTP site.
  4. Once the scheduled job picks up and processes the file, validate that the User's details are updated correctly in Coupa.

Sample CSV

Place the CSV file to the/Incoming/Users folder, where the file is picked up and processed in 5 minutes, and validate that the User's details are updated.

For a sample file, see modify_user.csv.

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.