Laravel Forge JavaScript SDK

Recipes

Recipes

Create a recipe

Method

forge.recipes.create(payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3const recipe = await forge.recipes.create(payload);

Payload

1{
2 name: 'Recipe Name',
3 user: 'root',
4 script: 'SCRIPT_CONTENT'
5}

Payload Parameters

KeyDescription
nameThe name of the recipe.
userThe user to run the recipe as.
scriptThe content of the script to run.

Example Response

1{
2 "recipe": {
3 "id": 1,
4 "name": "Recipe Name",
5 "user": "root",
6 "script": "SCRIPT_CONTENT",
7 "created_at": "2016-12-16 16:24:05"
8 }
9}

List all recipes

Method

forge.recipes.list()

Usage

1const forge = new Forge('API_TOKEN');
2
3const recipes = await forge.recipes.list();

Example Response

1{
2 "recipes": [
3 {
4 "id": 1,
5 "name": "Recipe Name",
6 "user": "root",
7 "script": "SCRIPT_CONTENT",
8 "created_at": "2016-12-16 16:24:05"
9 }
10 ]
11}

Get a recipe

Method

forge.recipes.get(recipe_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3const recipe = await forge.recipes.get(recipe_id);

Example Response

1{
2 "recipe": {
3 "id": 1,
4 "name": "Recipe Name",
5 "user": "root",
6 "script": "SCRIPT_CONTENT",
7 "created_at": "2016-12-16 16:24:05"
8 }
9}

Update a recipe

Method

forge.recipes.update(recipe_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3const recipe = await forge.recipes.update(recipe_id, payload);

Payload

1{
2 name: 'Recipe Name',
3 user: 'root',
4 script: 'SCRIPT_CONTENT'
5}

Payload Parameters

KeyDescription
nameThe name of the recipe.
userThe user to run the recipe as.
scriptThe content of the script to run.

Example Response

1{
2 "recipe": {
3 "id": 1,
4 "name": "Recipe Name",
5 "user": "root",
6 "script": "SCRIPT_CONTENT",
7 "created_at": "2016-12-16 16:24:05"
8 }
9}

Delete a recipe

Method

forge.recipes.delete(recipe_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.recipes.delete(recipe_id);

Run a recipe

Method

forge.recipes.run(recipe_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.recipes.run(recipe_id, payload);

Payload

1{
2 servers: [1, 2],
3 notify: true
4}

Payload Parameters

KeyDescription
serversArray of server id's to run the recipe on.
notifyWhether to send a notification upon recipe completion. Valid values are true or false.

Edit this page on GitHub