Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Localtabgroup
Localtab
activetrue
titleCLI

Updating a user via the CLI

Overview
CLI command
update-user
DescriptionUpdate a specific user.
Command format
Code Block
update-user -u <USERNAME> -p <PASSWORD> -r <ROLE_NAME> -f <FIRST_NAME> -l <LAST_NAME> -e <EMAIL> -pr <PROFILE_NAME>
Parameter definition
Short optionLong optionDescriptionRequiredExample value
-u

--username

Username given to the user.Yeskim
-p

--password

User's password.Yesadmin123
-r--role-name

Role assigned to the user.

Yesadmin
-f

--first-name

User's first name.YesKim
-l

--last-name

User's last name.YesMyers
-e

--email

User's email address.Yesfoo@bar.com
-pr--profile-nameUser's profile name.Yesdev
Example

Update the user with the username: kim.

Code Block
User updated successfully: kim
Sample output
Code Block
User added successfully: [user] kim
Localtab
titleREST API

Updating a user via the REST API

Overview
DescriptionUpdate a specific user.
Resource Path/users
HTTP MethodPUT
Request/Response Formatapplication/json
Command format
Code Block
curl -X PUT -H "Content-Type: application/json" -d @'<JSON_PAYLOAD>' -k -v -u <USERNAME>:<PASSWORD> https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/users
Info
  • The path to the JSON file that defines the user needs to be defined as the <JSON_PAYLOAD> value.
  • By default, <USERNAME>:<PASSWORD> is admin:admin.
  • By default, <PRIVATE_PAAS_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <PRIVATE_PAAS_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
Example

Add the user defined in the user.json file. 

Code Block
curl -X PUT -H "Content-Type: application/json" -d @'user.json' -k -v -u admin:admin https://localhost:9443/api/users
Sample output
Code Block
> PUT /api/users HTTP/1.1
> Host: localhost:9443
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 136
> 
< HTTP/1.1 200 OK
< Date: Wed, 14 Oct 2015 04:51:47 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server
< 
{"status":"success","message":"User updated successfully: [user] kim"

You will come across the following HTTP status codes while adding a user:

HTTP status code

201, 404, 500

See the descriptions of the HTTP status codes here.

  

...

Sample user JSON

Insert excerpt
Adding a User
Adding a User
nopaneltrue

...