You can add domain mappings using the CLI tool or REST API as shown below:
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.
Adding domain mappings via the CLI
Overview
CLI command | add-domain-mapping |
Description | Add 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 |
Parameter definition
Short option | Long option | Description | Required | Example value |
---|---|---|---|---|
N/A | N/A | ID of the application. | Yes |
|
|
| Folder path where the JSON file that defines the domain mappings is stored. | Yes | <ANY_PATH>/domainmappings.json |
Example
Add the domain mappings defined in the <TEST>/domainmappings.json
file to the application with the ID: wso2am-190-application
add-domain-mappings wso2am-190-application -p <TEST_PATH>/domainmappings.json
Sample output
Adding domain mappings via the REST API
Overview
Description | Add one or more domain mappings for a cluster. |
Resource Path |
|
HTTP Method | POST |
Request/Response Format |
|
Command format | curl -X POST -H "Content-Type: application/json" -d @'<JSON_PAYLOAD>' -k -v -u <USERNAME>:<PASSWORD> https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/applications/{applicationId}/domainMappings
|
Example
Add the domain mappings in the <TEST_PATH>/domainmappings.json
file and add this domain mapping to the application with the ID: wso2am-190-application.
cd <TEST_PATH> curl -X POST -H "Content-Type: application/json" -d @'domain-mappings.json' -k -v -u admin:admin https://localhost:9443/api/applications/wso2am-190-application/domainMappings
Sample output
You will come across the following HTTP status codes while adding an application:
HTTP status code | 200, 500 See the descriptions of the HTTP status codes here. |
Location header URL |
|
Sample domain mapping JSON
{ "domainMappings": [ { "cartridgeAlias": "tomcat", "domainName": "abc.com", "contextPath": "/abc/app" } ] }