ServerMania logo

Get List of Recipes

To get the list of all recipes in your cloud, use the following request:

GET /recipes.xml
GET /recipes.json

XML Request Example

curl -i -X GET -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:userpass --url http://test/recipes.xml

JSON Request Example

curl -i -X GET -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass --url http://test/recipes.json

XML Output Example

<recipes>
 <recipe>
  <compatible_with>unix</compatible_with>
  <created_at type="datetime">2012-10-22T12:46:49+00:00</created_at>
  <description>Create initial folder structure</description>
  <id type="integer">1</id>
  <label>Create folders</label>
  <script_type>vbs</script_type>
  <updated_at type="datetime">2012-10-22T12:46:49+00:00</updated_at>
  <user_id type="integer">2</user_id>
  <recipe_steps type="array">
   <recipe_step>
    <created_at type="datetime">2012-10-22T12:46:49+00:00</created_at>
    <fail_anything_else type="boolean">true</fail_anything_else>
    <fail_values/>
    <failure_goto_step type="integer">2</failure_goto_step>
    <id type="integer">1</id>
    <number type="integer">1</number>
    <on_failure>goto_step</on_failure>
    <on_success>proceed</on_success>
    <pass_anything_else type="boolean">false</pass_anything_else>
    <pass_values type="boolean">true</pass_values>
    <recipe_id type="integer">1</recipe_id>
    <result_source>exit_code</result_source>
    <script>mkdir /tmp</script>
    <success_goto_step nil="true"/>
    <updated_at type="datetime">2012-10-22T12:46:49+00:00</updated_at>
   </recipe_step>
  </recipe_steps>
 </recipe>
 <recipe>
  <id type="integer">193</id>
  <user_id type="integer">8</user_id>
  <created_at type="dateTime">2019-03-04T11:03:48+02:00</created_at>
  <updated_at type="dateTime">2019-03-06T17:06:41+02:00</updated_at>
  <label>CP Revoke IP address </label>
  <description>
  Add ability to trigger recipes on add/remove IP address for a virtual server
  </description>
  <script_type nil="true"/>
  <compatible_with>unix</compatible_with>
  <recipe_steps type="array">
   <recipe_step>
	<id type="integer">321</id>
	<recipe_id type="integer">193</recipe_id>
	<number type="integer">1</number>
	<script>
	echo "Add IP address. Step1" >> /tmp/recipe.txt; echo "IPJOIN_IP_ADDRESS_ID $IPJOIN_IP_ADDRESS_ID" >> /tmp/IPJOIN_IP_ADDRESS_ID.txt; echo "IPJOIN_IP_ADDRESS $IPJOIN_IP_ADDRESS" >> /tmp/IPJOIN_IP_ADDRESS.txt; echo "IPJOIN_NETWORK_IDENTIFIER $IPJOIN_NETWORK_IDENTIFIER" >> /tmp/IPJOIN_NETWORK_IDENTIFIER.txt; echo "IPJOIN_NIC_MAC_ADDRESS $IPJOIN_NIC_MAC_ADDRESS" >> 	/tmp/IPJOIN_NIC_MAC_ADDRESS.txt; echo "IPJOIN_HYPERVISOR_IP_ADDRESS $IPJOIN_HYPERVISOR_IP_ADDRESS" >> /tmp/IPJOIN_HYPERVISOR_IP_ADDRESS.txt; echo "TRIGGERING_EVENTS $TRIGGERING_EVENTS" >> /tmp/TRIGGERING_EVENTS.txt; echo "IPJOIN_HYPERVISOR_NETWORK_INTERFACE $IPJOIN_HYPERVISOR_NETWORK_INTERFACE" >> /tmp/IPJOIN_HYPERVISOR_NETWORK_INTERFACE.txt;
	</script>
	<on_success>proceed</on_success>
	<on_failure>proceed</on_failure>
	<success_goto_step nil="true"/>
	<created_at type="dateTime">2019-03-04T11:04:17+02:00</created_at>
	<updated_at type="dateTime">2019-03-13T14:51:09+02:00</updated_at>
	<result_source>exit_code</result_source>
	<pass_values>0</pass_values>
	<pass_anything_else type="boolean">false</pass_anything_else>
	<fail_values/>
	<fail_anything_else type="boolean">true</fail_anything_else>
	<failure_goto_step nil="true"/>
   </recipe_step>
  </recipe_steps>
 </recipe>
</recipes>

Where:

compatible_with - recipe compatibility: windows or unix

created_at — the date when the recipe was created in the [YYYY][MM][DD]T[hh][mm][ss]Z format

description - recipe description

id - recipe ID

label - recipe label

script_type - script type for Windows-compatible recipes:

  • bat 
  • vbs 
  • powershell (PowerShell v1.0)

updated_at — the date when the recipe was updated in the [YYYY][MM][DD]T[hh][mm][ss]Z format

use_on_hv_zones - true, if the recipe can be used on compute zones, otherwise false

use_on_vms - true, if the recipe can be used on virtual servers, otherwise false

user_id — the ID of a recipe owner

recipe_steps - an array of recipe steps with the following details:

  • created_at — the date when the step was created in the [YYYY][MM][DD]T[hh][mm][ss]Z format

  • updated_at — the date when the step was updated in the [YYYY][MM][DD]T[hh][mm][ss]Z format

  • fail_anything_else - set true, if you have specified the recipe pass value, otherwise set false

    You can only specify behavior for one scenario: for example, if the fail_anything_else = false, pass_anything_else must be set to true.
  • fail_values - recipe fail value

  • failure_goto_step - if the on_failure parameter = goto_step, specify the step to proceed to. If you specify the nonexistent step, the recipe will be stopped.

  • id - step ID

  • number - step number

  • (lightbulb)script - recipe step code where you can specify the following values:
    • IPJOIN_IP_ADDRESS_ID - ID of the IP Address

    • IPJOIN_IP_ADDRESS - IP address as a string

    • IPJOIN_NETWORK_IDENTIFIER - MAC address of network interface the IP address is assigned to

    • IPJOIN_NIC_MAC_ADDRESS - MAC address of the network interface

    • IPJOIN_HYPERVISOR_IP_ADDRESS - compute resource management IP address, the VS (with network interface with the assigned IP) is located on
    • TRIGGERING_EVENTS - events, which triggered the execution of a recipe

    • IPJOIN_HYPERVISOR_NETWORK_INTERFACE - network interface on the compute resource to which the network is connected to
  • on_failure - step behavior in case of failure:

    • proceed - proceed to the next step.
    • fail - terminate the recipe and mark it as failed.
    • stop - terminate the recipe and mark it as successful.
    • go_to_step - specify the step to proceed to. If you specify the nonexistent step, the recipe will be stopped.

  • on_success - step behavior in case of success:

    • proceed - proceed to the next step.
    • fail - terminate the recipe and mark it as failed.
    • stop - terminate the recipe and mark it as successful.
    • go_to_step - specify the step to proceed to. If you specify the nonexistent step, the recipe will be stopped.

  • pass_anything_else -  set true, if you have specified the recipe fail value, otherwise set false

  • pass_values - recipe pass value

  • recipe_id - ID of a recipe the step belongs to

  • result_source - step result source:

    • exit_code - an exit status, e.g. 0 will be returned on success

    • std_out - standard output
    • std_err - standard error
    • std_out_and_std_err - standard output and standard error
  • success_goto_step - if the on_success parameter = goto_step, specify the step to proceed to. If you specify the nonexistent step, the recipe will be stopped.


Page History

v.6.1

  • added the script parameter