Laravel Forge JavaScript SDK
Recipes
Recipes
Create a recipe
Method
forge.recipes.create(payload)
Usage
1const forge = new Forge('API_TOKEN');23const recipe = await forge.recipes.create(payload);
Payload
1{2 name: 'Recipe Name',3 user: 'root',4 script: 'SCRIPT_CONTENT'5}
Payload Parameters
Key | Description |
---|---|
name | The name of the recipe. |
user | The user to run the recipe as. |
script | The 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');23const 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');23const 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');23const recipe = await forge.recipes.update(recipe_id, payload);
Payload
1{2 name: 'Recipe Name',3 user: 'root',4 script: 'SCRIPT_CONTENT'5}
Payload Parameters
Key | Description |
---|---|
name | The name of the recipe. |
user | The user to run the recipe as. |
script | The 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');23await forge.recipes.delete(recipe_id);
Run a recipe
Method
forge.recipes.run(recipe_id, payload)
Usage
1const forge = new Forge('API_TOKEN');23await forge.recipes.run(recipe_id, payload);
Payload
1{2 servers: [1, 2],3 notify: true4}
Payload Parameters
Key | Description |
---|---|
servers | Array of server id's to run the recipe on. |
notify | Whether to send a notification upon recipe completion. Valid values are true or false . |
Edit this page on GitHub