This documentation is for WSO2 Private PaaS 4.1.0. View documentation for the latest release.
Updating a Tenant - WSO2 Private PaaS 4.1.0 - WSO2 Documentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
||
Skip to end of metadata
Go to start of metadata

You can update a tenant using the CLI tool or the REST API as shown below:

  • The tenantDomain can not be changed in the updating process.

  • The tenantId needs to be given when updating a tenant. The tenantId can be retrieved by listing the tenant details.



Updating a tenant via the CLI

Overview
CLI command

update-tenant

DescriptionUpdate a specific tenant.
Command format
update-tenant -u <USERNAME> -f <FIRST_NAME> -l <LAST_NAME> -p <PASSWORD> -d <DOMAIN_NAME> -e <EMAIL> -i <TENANT_ID>
Parameter definition
Short optionLong optionDescriptionRequiredExample value
-u

--username

Username given to the TenantYesadmin
-f

--first-name

Tenant's first nameYesfrank
-l

--last-name

Tenant's last nameYesMyers
-p

--password

Tenant's passwordYesadmin123
-d

--domain-name

Tenant's domain nameYesfrank.com
-e

--email

Tenant's email addressYes[email protected]
-i--tenant-idTenant's ID.Yes1
Example

Update the tenant with the username: admin. 

update-tenant -u admin -f Frank -l Myers -p admin123 -d frank.com -e [email protected] -i 1
Sample output
Tenant updated successfully: frank.com

Updating a tenant via the REST API

Overview
DescriptionUpdate a tenant.
Resource Path/tenants
HTTP MethodPUT
Request/Response Formatapplication/json
Command format
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/tenants
  • The path to the JSON file that defines the tenant 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 tenant defined in the tenant.json  file. 

curl -X PUT -H "Content-Type: application/json" -d @'tenant.json' -k -v -u admin:admin https://localhost:9443/api/tenants
Sample output
> POST /api/tenants HTTP/1.1
> Host: localhost:9443
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 169
> 
< HTTP/1.1 201 Created
< Date: Wed, 14 Oct 2015 06:40:13 GMT
< Location: https://localhost:9443/api/tenants/frank.com
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server
< 
{"status":"success","message":"Tenant added successfully: [tenant] frank.com"}

You will come across the following HTTP status codes while updating a tenant:

HTTP status code

201, 404, 500

See the descriptions of the HTTP status codes here.

 


Sample tenant JSON

{
  "admin": "admin",
  "firstName": "Frank",
  "lastName": "Myers",
  "adminPassword": "admin123",
  "tenantDomain": "frank.com",
  "email": "[email protected]",
  "active": "true"
} 

 

  • No labels