Solved! Go to Solution.
Here is a sample command to add a VirtualHost:
curl -u $USERID:$PASSWORD -X POST http://<MANAGEMENT_SERVER>:<MANAGEMENT_PORT>/v1/o/<org>/e/<env>/virtualhosts -H "Content-Type: application/xml" -d @/tmp/default.xml
With this XML saved in /tmp/default.xml:
<VirtualHost name="default"> <HostAliases> <HostAlias>api.example.com</HostAlias> </HostAliases> <Interfaces/> <Port>80</Port> </VirtualHost>
If the "default" VirtualHost already exists, you will receive an error message like the following:
{ "code": "messaging.config.beans.VirtualHostAlreadyExists", "message": "Virtual host default already exists in environment <ENV>", "contexts": [] }
In order to update the existing VirtualHost, you simply need to append the name to the end of the URL when you do your POST. For example:
curl -u $USERID:$PASSWORD -X POST http://<MANAGEMENT_SERVER>:<MANAGEMENT_PORT>/v1/o/<org>/e/<env>/virtualhosts/default -H "Content-Type: application/xml" -d @/tmp/default.xml
Thanks.
Here is a sample command to add a VirtualHost:
curl -u $USERID:$PASSWORD -X POST http://<MANAGEMENT_SERVER>:<MANAGEMENT_PORT>/v1/o/<org>/e/<env>/virtualhosts -H "Content-Type: application/xml" -d @/tmp/default.xml
With this XML saved in /tmp/default.xml:
<VirtualHost name="default"> <HostAliases> <HostAlias>api.example.com</HostAlias> </HostAliases> <Interfaces/> <Port>80</Port> </VirtualHost>
If the "default" VirtualHost already exists, you will receive an error message like the following:
{ "code": "messaging.config.beans.VirtualHostAlreadyExists", "message": "Virtual host default already exists in environment <ENV>", "contexts": [] }
In order to update the existing VirtualHost, you simply need to append the name to the end of the URL when you do your POST. For example:
curl -u $USERID:$PASSWORD -X POST http://<MANAGEMENT_SERVER>:<MANAGEMENT_PORT>/v1/o/<org>/e/<env>/virtualhosts/default -H "Content-Type: application/xml" -d @/tmp/default.xml
Thanks.
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |