Skip to content
Rigel docs
Open Rigel

Set what to buy for a dish

meals.dish.set_ingredients

POST/api/v1/households/{household_id}/commands/meals.dish.set_ingredients

  • Command
  • Rigel runs it
  • Applies offline

Replaces what to buy for the dish with items, in order, so the week's groceries can be worked out. Fails with dish_has_recipe if the dish has a recipe, which supplies the ingredients: change the recipe instead (meals.dish.update with recipe_id, or the recipe's own commands). Each item is a product from the shared product list, named by ID or by name (a new name adds the product). Naming a product twice keeps it once. An empty list clears it. Amounts are free text and never added up.

Parameters#

Set what to buy for a dish: parameters
FieldDescription
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.

Set what to buy for a dish: request body fields
FieldDescription
dish_idstringrequired

A dish ID, such as dsh_01JC0000000000000000000000.

itemsarray of one of 2 shapesrequired

What to buy, in order, up to 100 items.

at most 100 items
Shape 1, with product_id
items[].product_idstringrequired

A product ID, such as prd_01JC0000000000000000000000.

items[].amount_notestring or nulloptional

Free text about how much, such as "1 pack". Never added up. Null or left out for none.

at most 120 characters
Shape 2, with product_name
items[].product_namestringrequired

A product by name, such as "flour tortillas". The product with that name (ignoring case) is used, or a new one is added to the shared product list.

1 to 120 characters
items[].amount_notestring or nulloptional

Free text about how much, such as "1 pack". Never added up. Null or left out for none.

at most 120 characters

Response#

200 The command was applied.

Set what to buy for a dish: response fields
FieldDescription
resultobjectrequired

What the command returned, such as the IDs it created.

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.

Set what to buy for a dish: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404dish_not_foundA missing dish.
404product_not_foundA product that isn't on the list.
404not_foundThe household doesn't exist, or you aren't a member of it.
409dish_has_recipeA dish with a recipe gets its ingredients from the recipe: dish_has_recipe.
409idempotency_key_reusedThe 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 dish with none gets rows in order, by product ID and by name, adding a new product

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P00",
      "amount_note": "1 pack"
    },
    {
      "product_name": "salsa verde"
    }
  ]
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    dish_id: "dsh_01JC000000000000000000000A",
    items: [
      {
        product_id: "prd_01JC0000000000000000000P00",
        amount_note: "1 pack",
      },
      {
        product_name: "salsa verde",
      },
    ],
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P00",
      "amount_note": "1 pack"
    },
    {
      "product_name": "salsa verde"
    }
  ]
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0YN28BS26YH106RV1

{
  "result": {},
  "version": 1
}

A product name matching one on the list, ignoring case, uses it

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_name": "Cheese",
      "amount_note": "8 oz"
    }
  ]
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    dish_id: "dsh_01JC000000000000000000000A",
    items: [
      {
        product_name: "Cheese",
        amount_note: "8 oz",
      },
    ],
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_name": "Cheese",
      "amount_note": "8 oz"
    }
  ]
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0766G2HH4AC3FPX1Z

{
  "result": {},
  "version": 1
}

Rows are kept by product: a changed note or place updates them, and products left out are deleted

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P02"
    },
    {
      "product_id": "prd_01JC0000000000000000000P00",
      "amount_note": "2 packs"
    }
  ]
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    dish_id: "dsh_01JC000000000000000000000A",
    items: [
      {
        product_id: "prd_01JC0000000000000000000P02",
      },
      {
        product_id: "prd_01JC0000000000000000000P00",
        amount_note: "2 packs",
      },
    ],
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P02"
    },
    {
      "product_id": "prd_01JC0000000000000000000P00",
      "amount_note": "2 packs"
    }
  ]
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0QM5HVMDNBZVQP0J7

{
  "result": {},
  "version": 1
}

The same list changes nothing

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P00",
      "amount_note": "1 pack"
    },
    {
      "product_name": "chicken"
    }
  ]
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    dish_id: "dsh_01JC000000000000000000000A",
    items: [
      {
        product_id: "prd_01JC0000000000000000000P00",
        amount_note: "1 pack",
      },
      {
        product_name: "chicken",
      },
    ],
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P00",
      "amount_note": "1 pack"
    },
    {
      "product_name": "chicken"
    }
  ]
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0CQ96PBS3TT3YYWQT

{
  "result": {},
  "version": 1
}

A product named twice is kept once, in its first place, with both notes

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P01",
      "amount_note": "1 lb"
    },
    {
      "product_id": "prd_01JC0000000000000000000P00"
    },
    {
      "product_name": "CHICKEN",
      "amount_note": "for the kids"
    }
  ]
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    dish_id: "dsh_01JC000000000000000000000A",
    items: [
      {
        product_id: "prd_01JC0000000000000000000P01",
        amount_note: "1 lb",
      },
      {
        product_id: "prd_01JC0000000000000000000P00",
      },
      {
        product_name: "CHICKEN",
        amount_note: "for the kids",
      },
    ],
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P01",
      "amount_note": "1 lb"
    },
    {
      "product_id": "prd_01JC0000000000000000000P00"
    },
    {
      "product_name": "CHICKEN",
      "amount_note": "for the kids"
    }
  ]
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R03RGXRC76GMXGGZ3N

{
  "result": {},
  "version": 1
}

An empty list clears what to buy

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": []
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    dish_id: "dsh_01JC000000000000000000000A",
    items: [],
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": []
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R085774NQQ2HHD4EXN

{
  "result": {},
  "version": 1
}

A missing dish

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P00"
    }
  ]
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    dish_id: "dsh_01JC000000000000000000000A",
    items: [
      {
        product_id: "prd_01JC0000000000000000000P00",
      },
    ],
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P00"
    }
  ]
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R011NE1W4EJBVBHT7G

{
  "error": {
    "code": "dish_not_found",
    "message": "That dish isn't there any more. No changes were applied.",
    "details": {
      "dish_id": "dsh_01JC000000000000000000000A"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R011NE1W4EJBVBHT7G"
  }
}

A product that isn't on the list

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P09"
    }
  ]
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    dish_id: "dsh_01JC000000000000000000000A",
    items: [
      {
        product_id: "prd_01JC0000000000000000000P09",
      },
    ],
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P09"
    }
  ]
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0VVMTMPX4G5FBERDQ

{
  "error": {
    "code": "product_not_found",
    "message": "That product isn't there any more. No changes were applied.",
    "details": {
      "product_id": "prd_01JC0000000000000000000P09"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0VVMTMPX4G5FBERDQ"
  }
}

A dish with a recipe gets its ingredients from the recipe: dish_has_recipe

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P00"
    }
  ]
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    dish_id: "dsh_01JC000000000000000000000A",
    items: [
      {
        product_id: "prd_01JC0000000000000000000P00",
      },
    ],
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.set_ingredients HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "dish_id": "dsh_01JC000000000000000000000A",
  "items": [
    {
      "product_id": "prd_01JC0000000000000000000P00"
    }
  ]
}
Response, 409
HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R04B01BG643FC1FVJD

{
  "error": {
    "code": "dish_has_recipe",
    "message": "That dish is made from a recipe, so it buys the recipe's ingredients. Change the recipe instead, or unlink it first. No changes were applied.",
    "details": {
      "dish_id": "dsh_01JC000000000000000000000A",
      "recipe_id": "rcp_01JC000000000000000000000A"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R04B01BG643FC1FVJD"
  }
}

Say what a dish needs from the store

Items are products, by ID or by name. A name that isn't a product yet adds one.

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.set_ingredients' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01M6V9CSFAXQAD516S3137V0Z9' \
  -d '{
  "dish_id": "dsh_01M6V9CSF42115AECDV14HYQ9G",
  "items": [
    {
      "product_name": "Chicken thighs",
      "amount_note": "about 2 lb"
    },
    {
      "product_name": "Tortillas",
      "amount_note": "8 small"
    },
    {
      "product_id": "prd_01M6V9CSAMSN9ZJ52PTTKT8G6M",
      "amount_note": "1 can"
    }
  ]
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.set_ingredients", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01M6V9CSFAXQAD516S3137V0Z9",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    dish_id: "dsh_01M6V9CSF42115AECDV14HYQ9G",
    items: [
      {
        product_name: "Chicken thighs",
        amount_note: "about 2 lb",
      },
      {
        product_name: "Tortillas",
        amount_note: "8 small",
      },
      {
        product_id: "prd_01M6V9CSAMSN9ZJ52PTTKT8G6M",
        amount_note: "1 can",
      },
    ],
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.set_ingredients HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSFAXQAD516S3137V0Z9

{
  "dish_id": "dsh_01M6V9CSF42115AECDV14HYQ9G",
  "items": [
    {
      "product_name": "Chicken thighs",
      "amount_note": "about 2 lb"
    },
    {
      "product_name": "Tortillas",
      "amount_note": "8 small"
    },
    {
      "product_id": "prd_01M6V9CSAMSN9ZJ52PTTKT8G6M",
      "amount_note": "1 can"
    }
  ]
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSFA6TN0FAVQZKEYZDES

{
  "result": {},
  "version": 73
}

Give ingredients to a dish that has a recipe

A dish made from a recipe buys the recipe's ingredients, so change the recipe instead.

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.set_ingredients' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01M6V9CSFW1EGKN3AXM5V5EPGA' \
  -d '{
  "dish_id": "dsh_01M6V9CSFS845RH6KG1MJJPG63",
  "items": [
    {
      "product_name": "Orzo"
    }
  ]
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.set_ingredients", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01M6V9CSFW1EGKN3AXM5V5EPGA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    dish_id: "dsh_01M6V9CSFS845RH6KG1MJJPG63",
    items: [
      {
        product_name: "Orzo",
      },
    ],
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.set_ingredients HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSFW1EGKN3AXM5V5EPGA

{
  "dish_id": "dsh_01M6V9CSFS845RH6KG1MJJPG63",
  "items": [
    {
      "product_name": "Orzo"
    }
  ]
}
Response, 409
HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01M6V9CSFWBMRMM04CGSWEZKKA

{
  "error": {
    "code": "dish_has_recipe",
    "message": "That dish is made from a recipe, so it buys the recipe's ingredients. Change the recipe instead, or unlink it first. No changes were applied.",
    "details": {
      "dish_id": "dsh_01M6V9CSFS845RH6KG1MJJPG63",
      "recipe_id": "rcp_01M6V9CSD8VZYF11AC568Y7QPZ"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01M6V9CSFWBMRMM04CGSWEZKKA"
  }
}

For Rigel#

Rigel's tool for this command is meals_dish_set_ingredients. Rigel runs this on its own, then says what it did. The agent guide has the rest.

Rigel is in early access, and sign-up is by invitation. Open Rigel