Make a recipe
recipes.recipe.create
POST/api/v1/households/{household_id}/commands/recipes.recipe.create
- Command
- Rigel runs it
- Applies offline
Makes a recipe with its ingredients and steps if known, in the order given. Steps name their ingredients by ingredient_indexes, 0-based positions in this command's ingredients list. Give based_on_recipe_id for a version of another recipe, and fill the source fields whenever the recipe comes from somewhere. For a recipe from a web page, use recipes.recipe.import_url instead.
Parameters#
| Field | Description |
|---|---|
household_idpathstringrequired | The household's ID. |
Idempotency-Keyheaderstringoptional | The command's ID. Reuse it when retrying the same command. |
Request body#
JSON, as application/json.
| Field | Description |
|---|---|
titlestringrequired | The recipe's title, as written, 1–200 characters. |
servingsintegerrequired | How many servings the amounts make, a whole number from 1 to 100. |
summarystring or nulloptional | One or two sentences about the recipe, at most 500 characters. |
prep_minutesinteger or nulloptional | A time in whole minutes, 0–2,880 (two days). |
cook_minutesinteger or nulloptional | A time in whole minutes, 0–2,880 (two days). |
notesstring or nulloptional | Kitchen notes on the whole recipe, as written, at most 5,000 characters: "Freezes well for 3 months." |
source_titlestring or nulloptional | Where the recipe came from, as published, at most 200 characters: a title, a site or book, or an author. |
source_sitestring or nulloptional | Where the recipe came from, as published, at most 200 characters: a title, a site or book, or an author. |
source_authorstring or nulloptional | Where the recipe came from, as published, at most 200 characters: a title, a site or book, or an author. |
based_on_recipe_idstring or nulloptional | The recipe this one is a version of. |
source_urlstring (uri) or nulloptional | A web address starting with http:// or https://, at most 2,000 characters. |
ingredientsarray of objectsoptional | Ingredient lines in order, at most 200. |
ingredients[].sectionstring or nulloptional | A group heading such as "For the paneer" or "Sauce", 1–80 characters. |
ingredients[].product_idstring or nulloptional | The product from the shared product list ( |
ingredients[].namestringrequired | The ingredient as written, 1–200 characters: "boneless chicken thighs". |
ingredients[].quantitynumber or nulloptional | How much, or null for 'to taste' or 'a pinch'. |
ingredients[].quantity_maxnumber or nulloptional | The top of a range such as 2–3 cloves; more than quantity. Null if it isn't a range. |
ingredients[].unitone of: mg, g, kg, oz, lb, ml, l, tsp, tbsp, fl_oz, cup, pint, quart, gallon, pinch, dash, clove, slice, stick, sprig, head, bunch, stalk, can, jar, bottle, box, bag, package, carton, roll, null or nulloptional | A unit. Mass: mg, g, kg, oz, lb. Volume (US sizes): ml, l, tsp, tbsp, fl_oz, cup, pint, quart, gallon. Items, for a count of something other than the thing itself (2 cloves of garlic, 1 can of beans): pinch, dash, clove, slice, stick, sprig, head, bunch, stalk, can, jar, bottle, box, bag, package, carton, roll. Leave it out or null for a plain count of the things themselves (3 eggs). |
ingredients[].preparationstring or nulloptional | How the ingredient is prepared, at most 200 characters: "diced", "at room temperature". |
ingredients[].is_optionalbooleanoptional | Whether the ingredient can be left out. Defaults to false. |
stepsarray of objectsoptional | Steps in order, at most 200. |
steps[].sectionstring or nulloptional | A group heading such as "For the paneer" or "Sauce", 1–80 characters. |
steps[].textstringrequired | The instruction, as written, 1–2,000 characters. |
steps[].timer_secondsinteger or nulloptional | A timer this step offers in cooking mode, in seconds, 1–86,400. Simmer 12 minutes is 720. |
steps[].notestring or nulloptional | A kitchen note on this step, at most 1,000 characters. |
steps[].ingredient_indexesarray of integersoptional | Which of this command's ingredients the step uses, as 0-based positions in the ingredients list. |
Response#
200 The command was applied.
| Field | Description |
|---|---|
resultobjectrequired | What the command returned, such as the IDs it created. |
result.recipe_idstringrequired | The new recipe. |
result.ingredient_idsarray of stringsrequired | The new ingredients, in the order given. |
result.step_idsarray of stringsrequired | The new steps, in the order given. |
versionintegerrequired | The household version after the command. |
Errors#
Every error has the same envelope: error.code, error.message, error.details, error.recovery and error.request_id.
| Status | Code | When |
|---|---|---|
400 | validation_failed | A field is missing, misspelled or out of range. details.fields lists each problem. |
401 | unauthenticated | The request has no valid session. |
404 | recipe_not_found | Based on a recipe that isn't there. |
404 | ingredient_not_found | A step that uses an ingredient that isn't in the list. |
404 | not_found | The household doesn't exist, or you aren't a member of it. |
409 | idempotency_key_reused | The Idempotency-Key was already used for a different command. |
Examples#
These are real. Each scenario is one of the command's test cases, run on a household when this site was built, and the response is what the API returned.
A recipe with just a title and servings
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"title": "Pancakes",
"servings": 4
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
title: "Pancakes",
servings: 4,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"title": "Pancakes",
"servings": 4
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R01PFE35YV1YDQ4V7Y
{
"result": {
"recipe_id": "rcp_01JC4N0000MBGE5RJ6Q7V6V6T8",
"ingredient_ids": [],
"step_ids": []
},
"version": 1
}Ingredients and steps in order, with step links by index
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"title": "Pancakes",
"servings": 4,
"summary": "Fluffy.",
"prep_minutes": 10,
"cook_minutes": 15,
"source_url": "https://example.com/pancakes",
"source_site": "Example",
"ingredients": [
{
"name": "flour",
"quantity": 2,
"unit": "cup"
},
{
"name": "eggs",
"quantity": 2,
"quantity_max": 3,
"is_optional": true
}
],
"steps": [
{
"text": "Mix",
"ingredient_indexes": [
0,
1
]
},
{
"text": "Fry",
"timer_seconds": 180,
"section": "Cooking"
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
title: "Pancakes",
servings: 4,
summary: "Fluffy.",
prep_minutes: 10,
cook_minutes: 15,
source_url: "https://example.com/pancakes",
source_site: "Example",
ingredients: [
{
name: "flour",
quantity: 2,
unit: "cup",
},
{
name: "eggs",
quantity: 2,
quantity_max: 3,
is_optional: true,
},
],
steps: [
{
text: "Mix",
ingredient_indexes: [
0,
1,
],
},
{
text: "Fry",
timer_seconds: 180,
section: "Cooking",
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"title": "Pancakes",
"servings": 4,
"summary": "Fluffy.",
"prep_minutes": 10,
"cook_minutes": 15,
"source_url": "https://example.com/pancakes",
"source_site": "Example",
"ingredients": [
{
"name": "flour",
"quantity": 2,
"unit": "cup"
},
{
"name": "eggs",
"quantity": 2,
"quantity_max": 3,
"is_optional": true
}
],
"steps": [
{
"text": "Mix",
"ingredient_indexes": [
0,
1
]
},
{
"text": "Fry",
"timer_seconds": 180,
"section": "Cooking"
}
]
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0BFGWR3BZA78TNE5N
{
"result": {
"recipe_id": "rcp_01JC4N0000MBGE5RJ6Q7V6V6T8",
"ingredient_ids": [
"rci_01JC4N0000VGW1STJ6TGXRB7FY",
"rci_01JC4N0000JVP6PWJ6S8P7WZ6B"
],
"step_ids": [
"rcs_01JC4N0000H4B98ZJ6CJHSCWXM",
"rcs_01JC4N0000YZAF17K656HFY59N"
]
},
"version": 1
}A version based on another recipe
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"title": "Meatless pancakes",
"servings": 4,
"based_on_recipe_id": "rcp_01JC000000000000000000000A"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
title: "Meatless pancakes",
servings: 4,
based_on_recipe_id: "rcp_01JC000000000000000000000A",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"title": "Meatless pancakes",
"servings": 4,
"based_on_recipe_id": "rcp_01JC000000000000000000000A"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R00Z0FV24QC4VMN83K
{
"result": {
"recipe_id": "rcp_01JC4N0000MBGE5RJ6Q7V6V6T8",
"ingredient_ids": [],
"step_ids": []
},
"version": 1
}Based on a recipe that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"title": "Pancakes",
"servings": 4,
"based_on_recipe_id": "rcp_01JC000000000000000000000A"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
title: "Pancakes",
servings: 4,
based_on_recipe_id: "rcp_01JC000000000000000000000A",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"title": "Pancakes",
"servings": 4,
"based_on_recipe_id": "rcp_01JC000000000000000000000A"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R04B8Q5J0G2MY59Z3M
{
"error": {
"code": "recipe_not_found",
"message": "That recipe isn't in the recipe box any more. No changes were applied.",
"details": {
"recipe_id": "rcp_01JC000000000000000000000A"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R04B8Q5J0G2MY59Z3M"
}
}A step that uses an ingredient that isn't in the list
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"title": "Pancakes",
"servings": 4,
"steps": [
{
"text": "Mix",
"ingredient_indexes": [
0
]
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
title: "Pancakes",
servings: 4,
steps: [
{
text: "Mix",
ingredient_indexes: [
0,
],
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/recipes.recipe.create HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"title": "Pancakes",
"servings": 4,
"steps": [
{
"text": "Mix",
"ingredient_indexes": [
0
]
}
]
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0P8AT21TJPJVEEV60
{
"error": {
"code": "ingredient_not_found",
"message": "Step 1 uses ingredient number 0, which isn't in the list. No changes were applied.",
"details": {
"index": 0
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0P8AT21TJPJVEEV60"
}
}Add a recipe
Ingredients can point at products the household already has. Steps point at the ingredients they use by position.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/recipes.recipe.create' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSD8AE30YEB6AMT6FY80' \
-d '{
"title": "Tomato and white bean orzo",
"summary": "One pot, 30 minutes. Good the next day too.",
"servings": 4,
"prep_minutes": 10,
"cook_minutes": 20,
"ingredients": [
{
"product_id": "prd_01M6V9CSAT6M58YWZ1H4DFY9K2",
"name": "olive oil",
"quantity": 2,
"unit": "tbsp"
},
{
"name": "garlic",
"quantity": 3,
"quantity_max": 4,
"unit": "clove",
"preparation": "minced"
},
{
"product_id": "prd_01M6V9CSAQDSZHDQNXHXRCDA8Z",
"name": "orzo",
"quantity": 1,
"unit": "cup"
},
{
"name": "crushed tomatoes",
"quantity": 1,
"unit": "can"
},
{
"name": "white beans",
"quantity": 1,
"unit": "can",
"preparation": "drained and rinsed"
},
{
"name": "vegetable broth",
"quantity": 2,
"unit": "cup"
},
{
"name": "baby spinach",
"quantity": 2,
"unit": "cup",
"is_optional": true
}
],
"steps": [
{
"text": "Warm the oil in a wide pot. Cook the garlic for 1 minute.",
"timer_seconds": 60,
"ingredient_indexes": [
0,
1
]
},
{
"text": "Stir in the orzo, tomatoes and broth. Simmer until the orzo is tender, stirring now and then.",
"timer_seconds": 600,
"ingredient_indexes": [
2,
3,
5
]
},
{
"text": "Add the beans, and the spinach if you have it. Cook until the spinach wilts.",
"timer_seconds": 180,
"ingredient_indexes": [
4,
6
]
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/recipes.recipe.create", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSD8AE30YEB6AMT6FY80",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
title: "Tomato and white bean orzo",
summary: "One pot, 30 minutes. Good the next day too.",
servings: 4,
prep_minutes: 10,
cook_minutes: 20,
ingredients: [
{
product_id: "prd_01M6V9CSAT6M58YWZ1H4DFY9K2",
name: "olive oil",
quantity: 2,
unit: "tbsp",
},
{
name: "garlic",
quantity: 3,
quantity_max: 4,
unit: "clove",
preparation: "minced",
},
{
product_id: "prd_01M6V9CSAQDSZHDQNXHXRCDA8Z",
name: "orzo",
quantity: 1,
unit: "cup",
},
{
name: "crushed tomatoes",
quantity: 1,
unit: "can",
},
{
name: "white beans",
quantity: 1,
unit: "can",
preparation: "drained and rinsed",
},
{
name: "vegetable broth",
quantity: 2,
unit: "cup",
},
{
name: "baby spinach",
quantity: 2,
unit: "cup",
is_optional: true,
},
],
steps: [
{
text: "Warm the oil in a wide pot. Cook the garlic for 1 minute.",
timer_seconds: 60,
ingredient_indexes: [
0,
1,
],
},
{
text: "Stir in the orzo, tomatoes and broth. Simmer until the orzo is tender, stirring now and then.",
timer_seconds: 600,
ingredient_indexes: [
2,
3,
5,
],
},
{
text: "Add the beans, and the spinach if you have it. Cook until the spinach wilts.",
timer_seconds: 180,
ingredient_indexes: [
4,
6,
],
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/recipes.recipe.create HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSD8AE30YEB6AMT6FY80
{
"title": "Tomato and white bean orzo",
"summary": "One pot, 30 minutes. Good the next day too.",
"servings": 4,
"prep_minutes": 10,
"cook_minutes": 20,
"ingredients": [
{
"product_id": "prd_01M6V9CSAT6M58YWZ1H4DFY9K2",
"name": "olive oil",
"quantity": 2,
"unit": "tbsp"
},
{
"name": "garlic",
"quantity": 3,
"quantity_max": 4,
"unit": "clove",
"preparation": "minced"
},
{
"product_id": "prd_01M6V9CSAQDSZHDQNXHXRCDA8Z",
"name": "orzo",
"quantity": 1,
"unit": "cup"
},
{
"name": "crushed tomatoes",
"quantity": 1,
"unit": "can"
},
{
"name": "white beans",
"quantity": 1,
"unit": "can",
"preparation": "drained and rinsed"
},
{
"name": "vegetable broth",
"quantity": 2,
"unit": "cup"
},
{
"name": "baby spinach",
"quantity": 2,
"unit": "cup",
"is_optional": true
}
],
"steps": [
{
"text": "Warm the oil in a wide pot. Cook the garlic for 1 minute.",
"timer_seconds": 60,
"ingredient_indexes": [
0,
1
]
},
{
"text": "Stir in the orzo, tomatoes and broth. Simmer until the orzo is tender, stirring now and then.",
"timer_seconds": 600,
"ingredient_indexes": [
2,
3,
5
]
},
{
"text": "Add the beans, and the spinach if you have it. Cook until the spinach wilts.",
"timer_seconds": 180,
"ingredient_indexes": [
4,
6
]
}
]
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSD8ANE98AGKNZXYGXJ9
{
"result": {
"recipe_id": "rcp_01M6V9CSD8VZYF11AC568Y7QPZ",
"ingredient_ids": [
"rci_01M6V9CSD8MJZZDY9C256CQPD0",
"rci_01M6V9CSD8HFZX76ACQ7929C3Z",
"rci_01M6V9CSD8J6BVN3AC4YDGRFCN",
"rci_01M6V9CSD8Q0HKRAACH243A5QR",
"rci_01M6V9CSD8GKH358ACE12HS4ES",
"rci_01M6V9CSD8DPC2ZFAC3657BTP5",
"rci_01M6V9CSD8Y6T0ADACG3WMTNWC"
],
"step_ids": [
"rcs_01M6V9CSD83SCWCMACXFJ7CBK6",
"rcs_01M6V9CSD8B7WBT18BW4WS3FAY",
"rcs_01M6V9CSD87PWCHB8B8VQY5XHE"
]
},
"version": 53
}Add a recipe with a source
source_title and the other source fields record where it came from.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/recipes.recipe.create' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSDDSQMASV5A2JG1RMZP' \
-d '{
"title": "Saturday pancakes",
"summary": "Fluffy, and easy for Nia to measure.",
"servings": 4,
"prep_minutes": 10,
"cook_minutes": 15,
"source_title": "Grandma Okafor'\''s recipe card",
"ingredients": [
{
"product_id": "prd_01M6V9CSAG72MC7ERJ4GCZ0X7A",
"name": "flour",
"quantity": 2,
"unit": "cup"
},
{
"name": "baking powder",
"quantity": 2,
"unit": "tsp"
},
{
"name": "salt",
"quantity": 1,
"unit": "pinch"
},
{
"product_id": "prd_01M6V9CSAWSAMCWTBQ2M7F80H9",
"name": "milk",
"quantity": 1.5,
"unit": "cup"
},
{
"name": "eggs",
"quantity": 2
},
{
"name": "butter",
"quantity": 3,
"unit": "tbsp",
"preparation": "melted"
}
],
"steps": [
{
"text": "Whisk the flour, baking powder and salt in a large bowl.",
"ingredient_indexes": [
0,
1,
2
]
},
{
"text": "Whisk the milk, eggs and butter in a second bowl, then stir into the flour until just combined.",
"ingredient_indexes": [
3,
4,
5
]
},
{
"text": "Cook 1/4 cup of batter at a time on a medium griddle, 2 minutes a side.",
"timer_seconds": 240
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/recipes.recipe.create", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSDDSQMASV5A2JG1RMZP",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
title: "Saturday pancakes",
summary: "Fluffy, and easy for Nia to measure.",
servings: 4,
prep_minutes: 10,
cook_minutes: 15,
source_title: "Grandma Okafor's recipe card",
ingredients: [
{
product_id: "prd_01M6V9CSAG72MC7ERJ4GCZ0X7A",
name: "flour",
quantity: 2,
unit: "cup",
},
{
name: "baking powder",
quantity: 2,
unit: "tsp",
},
{
name: "salt",
quantity: 1,
unit: "pinch",
},
{
product_id: "prd_01M6V9CSAWSAMCWTBQ2M7F80H9",
name: "milk",
quantity: 1.5,
unit: "cup",
},
{
name: "eggs",
quantity: 2,
},
{
name: "butter",
quantity: 3,
unit: "tbsp",
preparation: "melted",
},
],
steps: [
{
text: "Whisk the flour, baking powder and salt in a large bowl.",
ingredient_indexes: [
0,
1,
2,
],
},
{
text: "Whisk the milk, eggs and butter in a second bowl, then stir into the flour until just combined.",
ingredient_indexes: [
3,
4,
5,
],
},
{
text: "Cook 1/4 cup of batter at a time on a medium griddle, 2 minutes a side.",
timer_seconds: 240,
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/recipes.recipe.create HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSDDSQMASV5A2JG1RMZP
{
"title": "Saturday pancakes",
"summary": "Fluffy, and easy for Nia to measure.",
"servings": 4,
"prep_minutes": 10,
"cook_minutes": 15,
"source_title": "Grandma Okafor's recipe card",
"ingredients": [
{
"product_id": "prd_01M6V9CSAG72MC7ERJ4GCZ0X7A",
"name": "flour",
"quantity": 2,
"unit": "cup"
},
{
"name": "baking powder",
"quantity": 2,
"unit": "tsp"
},
{
"name": "salt",
"quantity": 1,
"unit": "pinch"
},
{
"product_id": "prd_01M6V9CSAWSAMCWTBQ2M7F80H9",
"name": "milk",
"quantity": 1.5,
"unit": "cup"
},
{
"name": "eggs",
"quantity": 2
},
{
"name": "butter",
"quantity": 3,
"unit": "tbsp",
"preparation": "melted"
}
],
"steps": [
{
"text": "Whisk the flour, baking powder and salt in a large bowl.",
"ingredient_indexes": [
0,
1,
2
]
},
{
"text": "Whisk the milk, eggs and butter in a second bowl, then stir into the flour until just combined.",
"ingredient_indexes": [
3,
4,
5
]
},
{
"text": "Cook 1/4 cup of batter at a time on a medium griddle, 2 minutes a side.",
"timer_seconds": 240
}
]
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSDD118YPSK3GXZ1YZNT
{
"result": {
"recipe_id": "rcp_01M6V9CSDDZVYFRVFNA4X5BSMZ",
"ingredient_ids": [
"rci_01M6V9CSDDREZZ4SFN73VKTRB0",
"rci_01M6V9CSDDNDNV70GNWFH6CE2T",
"rci_01M6V9CSDD6Y2TJXFN9D8MV981",
"rci_01M6V9CSDD3Q79AHFNYFMX8B2M",
"rci_01M6V9CSDDWDDWDFFNV6ZERAB7",
"rci_01M6V9CSDDS68QGPFNGHN1A0FK"
],
"step_ids": [
"rcs_01M6V9CSDDTB2JYKFNX1TFS3Z0",
"rcs_01M6V9CSDD7FDZQ8J5WVTWBDYP",
"rcs_01M6V9CSDDB80V0ZH5GXYQ9ZAG"
]
},
"version": 54
}For Rigel#
Rigel's tool for this command is recipes_recipe_create. Rigel runs this on its own, then says what it did. The agent guide has the rest.