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

You can search for tenants using the CLI tool or REST API as shown below:

  • List out tenants whose domain names have a particular letter or punctuation. For example, the following would provide details of all the tenants that have the letter k in the domain name.
    k
  • List out tenants whose domain names have a specific sequence of letters and punctuation. For example, the following would provide details of all the tenants that have .com in the domain name.
    .com

  • List out tenants by the domain name. For example, the following would list out the tenant with the domain name frank.com.

    frank.com

The search for tenants via partial domain will only succeed if the characters entered when executing the command are included in a tenant domain/s at the time of the search. If there are no tenant domains to match the given search the CLI Tool or REST API will return  No tenants found  as the output.



Searching for tenants via the CLI

Overview
CLI command

list-tenants

Description

Search for tenants based on the partial domain value entered.

Command format
list-tenants <PARTIAL_DOMAIN>
Example

Retrieve details of all the available tenants whose domain name have the sequence of: .com.

list-tenants .com
Sample output
Tenants found:
+--------------+----------+--------+-------------+------------------------------+
| tenantDomain | tenantID | active | email       | createdDate                  |
+--------------+----------+--------+-------------+------------------------------+
| frank.com    | 1        | true   | [email protected] | Wed Oct 14 11:39:14 IST 2015 |
+--------------+----------+--------+-------------+------------------------------+
| myers.com    | 2        | true   | [email protected] | Wed Oct 14 12:10:11 IST 2015 |
+--------------+----------+--------+-------------+------------------------------+

Searching for tenants via the REST API

Overview
DescriptionSearch for tenants. If the exact tenantDomain is not known, part of the tenant domain or any string (with or without the period symbol) can be entered as the tenant domain.
Resource Path/tenants/search/{tenantDomain}
HTTP MethodGET
Request/Response Formatapplication/json
Command format
curl -X GET -H "Content-Type: application/json" -k -v -u <USERNAME>:<PASSWORD> https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/tenants/search/{tenantDomain}

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

Retrieve details of all the available tenants whose domain name have the sequence of: .com .

curl -X GET -H "Content-Type: application/json" -k -v -u admin:admin https://localhost:9443/api/tenants/search/.com
Sample output

The  createdDate  is given in the Epoch time format.

> GET /api/tenants/search/.com HTTP/1.1
> Host: localhost:9443
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> 
< HTTP/1.1 200 OK
< Date: Thu, 15 Oct 2015 05:26:39 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server
< 
* Connection #0 to host localhost left intact
[{"active":true,"createdDate":1444802954640,"email":"[email protected]","tenantDomain":"frank.com","tenantId":1},{"active":true,"createdDate":1444804811968,"email":"[email protected]","tenantDomain":"myers.com","tenantId":2}]

You will come across the following HTTP status codes while searching for tenants:

HTTP status code

200, 404, 500

See the descriptions of the HTTP status codes here.

 


 

 

  • No labels