Overview

DescriptionAdd a new tenant.
Resource Path/tenants
HTTP MethodPOST
Request/Response Formatapplication/json

Sample request

{
  "admin": "admin",
  "firstName": "Frank",
  "lastName": "Myers",
  "adminPassword": "admin123",
  "tenantDomain": "frank.com",
  "email": "foo@bar.com",
  "active": "true"
}

For information on the property definitions, see Tenant Resource Definition.

> POST /api/tenants HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8| zlib/1.2.5
> Host: localhost:9443
> Accept: */*
> Content-Type: application/json
> Content-Length: 190
>
* upload completely sent off: 190 out of 190 bytes
< HTTP/1.1 201 Created
< Date: Tue, 17 Mar 2015 06:35:05 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"}
curl -X POST -H "Content-Type: application/json" -d @'<JSON_PAYLOAD>' -k -v -u admin:admin https://<STRATOS_HOST>:<STRATOS_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, <STRATOS_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <STRATOS_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.

CLI command
add-tenant
DescriptionAdd a new tenant.
Command format
add-tenant -u <USERNAME> -f <FIRST_NAME> -l <LAST_NAME> -p <PASSWORD> -d <DOMAIN_NAME> -e <EMAIL>

REST API response

HTTP status code

201, 400, 409, 500

See the descriptions of the HTTP status codes here.

Location header URLhttps://<STRATOS_HOST>:<STRATOS_HTTPS_PORT>/api/tenants/<TENANT_DOMAIN>
  • No labels