Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > RightScale API 1.5 > Examples > Users > Update User

Update User

The following examples update an existing user record. Note that the authorization logic is substantially different between SAML-based and password-based users; please consult the example that is most relevant to your use case.

Table of Contents

Curl

Update a password-based user

Prerequisite:  Example assumes you have previously authenticated, and your valid session cookie is in 'mycookie'.

  • One of the following must be true:
    • You are logged in as the user being updated
    • You provide the current_password of the user being updated (as evidence that you could login as that user)

Note:  A "\" has been added as a line-break for readability.  The actual curl command must be interpreted by the shell as a single line/command.

#!/bin/sh -e
USER_ID="2112"
CURRENT_PASSWORD="734PUMJGR7QNF"          
curl -i -H X_API_VERSION:1.5 -b mycookie \
-d user[email]='gregdoe@example.com' \
-d user[current_password]=$CURRENT_PASSWORD \
-d user[new_password]='SomeNewPassword' \
-d user[company]=RightDoe \
-d user[phone]=8051234567 \
-d user[first_name]=Greg \
-d user[last_name]=Doe 
-X PUT https://my.rightscale.com/api/users/$USER_ID
Sample Output
HTTP/1.1 200 OK
Server: nginx/0.7.67
Date: Wed, 24 Aug 2011 21:53:30 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 200 OK

Update a SAML User

Prerequisites:
  • You must have 'admin' permission on the account.
  • The user whose information you are updating must currently be linked to (via identity_provider_href) to one of your organizaiton's SAML providers. For more information, see the SAML Provisioning API End to End Tutorial.
  • If updating a user's SAML principal_uid (also known as "NameID" or "SAML subject,") you must know the value that your SAML provider will transmit to RightScale for this person.
user_id="7825"
curl -i -H X_API_Version:1.5 -b mycookie -X PUT \
 -d user[current_email]=john.smith@example.com \
 -d user[company]='New Company' \
 -d user[phone]=1234567890 \
 -d user[first_name]=John \
 -d user[last_name]=Doe \
 -d user[identity_provider_href]='/api/identity_providers/76' \
 -d user[principal_uid]='john.smith@example.com' \
https://my.rightscale.com/api/users/$user_id
Sample Output
HTTP/1.1 200 OK
Server: nginx/0.7.67
Date: Wed, 24 Aug 2011 21:53:30 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 200 OK

You must to post a comment.
Last modified
11:33, 3 Dec 2014

Tags

This page has no custom tags.

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.