ServerMania logo

Run Recipe on Multiple Virtual Servers

To run a recipe on multiple virtual servers, use the following request:

POST /recipes/:recipe_id/run.xml
POST /recipes/:recipe_id/run.json

XML Request Example

curl -i -X POST -H 'Accept: application/xml' -H 'Content-type:application/xml' -u user:userpass -d '<virtual_machines type="array"><virtual_machine>vm1_identifier</virtual_machine><virtual_machine>vm2_identifier</virtual_machine></virtual_machines>'  --url http://test/recipes/13/run.xml

JSON Request Example

curl -i -X POST -H 'Accept: application/json' -H 'Content-type: application/json' -u user:password -d '{"virtual_machines":[":vm1_identifier",":vm2_identifier"]}' --url http://test/recipes/13/run.json

Where:

vm1_identifier - replace this with the identifier of a virtual server you want to run the recipe on. ID of the required recipe in the URL.

This request returns the multi status code - 207.

When applying one recipe to several servers via API, there is possibility to run the recipe incompatible with the server type (Unix recipe on Windows server or vice versa). In this case the transaction will be scheduled and completed, but the recipe will not do anything.

To view the list of servers the particular recipe is applied to, see the Get List of Servers Using Recipe request.