This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • 4.1.x Adding Domain Mappings via REST API
Skip to end of metadata
Go to start of metadata

As the signup process takes place automatically when a single tenant application is deployed, domain mapping can be added straight after the application is deployed. However, if domain mapping is being added to a multi-tenant application, after the application is deployed, ensure to first carryout the application sign up process before adding the domain mappings.

Overview

DescriptionAdd one or more domain mappings for a cluster.
Resource Path

/applications/{applicationId}/domainMappings

HTTP MethodPOST
Request/Response Format

application/json

Sample request

{
  "domainMappings": [
    {
      "cartridgeAlias": "tomcat",
      "domainName": "abc.com",
      "contextPath": "/abc/app"
    }
  ]
}

For information on all the properties that can be used in a domain mapping definition, see the Domain Mapping Resource Definition.

> POST /api/applications/single-cartridge-app/domainMappings 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: 192.168.1.2:9443
> Accept: */*
> Content-Type: application/json
> Content-Length: 130
>
* upload completely sent off: 130 out of 130 bytes
< HTTP/1.1 200 OK
< Date: Thu, 02 Apr 2015 05:05:00 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server
<
{"status":"success","message":"Domain Mappings added successfully: [domain-mappings] [abc.com]"}
curl -X POST -H "Content-Type: application/json" -d @'<JSON_PAYLOAD>' -k -v -u admin:admin https://<STRATOS_HOST>:<STRATOS_HTTPS_PORT>/api/applications/{applicationId}/domainMappings
  • The path to the JSON file that defines the domain mapping 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.

For example:

cd <STRATOS_SOURCE_HOME>/samples/applications/single-cartridge/artifacts/
curl -X POST -H "Content-Type: application/json" -d @'domain-mappings.json' -k -v -u admin:admin https://localhost:9443/api/applications/single-cartridge-app/domainMappings


 
CLI commandadd-domain-mapping
DescriptionAdd domain mappings for the subscribed cartridge.
Command format

add-domain-mappings <APPLICATION-ID> -p <JSON_FILE_PATH>

The path to the JSON file that defines the domain mapping needs to be defined as the <JSON_FILE_PATH> value.


REST API Response

HTTP status code

200, 500

See the descriptions of the HTTP status codes here.

Location header URL

https://<STRATOS_HOST>:<STRATOS_HTTPS_PORT>/api/applications/<APPLICATION_ID>/domainMappings


  • No labels