Is it possible to create Virtual host with curl command in private cloud?

I would like to create an additional virtual host in the private cloud / on-premise solution . Is it possible to do via curl command please?

Solved Solved
0 4 761
1 ACCEPTED SOLUTION

Hi @Sujith Mathew You can create them using the management APIs. See here.

View solution in original post

4 REPLIES 4

Hi @Sujith Mathew You can create them using the management APIs. See here.

And just to add, you need to do this using a global user with system administrator privileges.

Hi @Sujith Mathew,

Yes, this is possible:

curl -v -u $USERID:$PASSWORD -X POST http[s]://<MANAGEMENT_HOST>:<MANAGEMENT_PORT>/v1/o/<ORG>/e/<ENV>/virtualhosts -H "content-type: application/xml" -d @/tmp/vhost.xml

Where /tmp/vhost.xml contains an XML representation of your VirtualHost (this can also be done with JSON definition by setting "content-type: application/json").

To see an example XML/JSON, simply do a GET on an existing vhost, like default for example:

curl -v -u $USERID:$PASSWORD -X GET http[s]://<MANAGEMENT_HOST>:<MANAGEMENT_PORT>/v1/o/<ORG>/e/<ENV>/virtualhosts/default

I hope this helps. Thanks.

Can you please share CURL command to validate association of MPs to virtual host.

Lets say, I associated 4 MPs to single virtual host, how do i check using CURL if associations are successful ?