Skip to content
Rigel docs
Open Rigel

Put a product in a group or take it out

shopping.group.set_member

POST/api/v1/households/{household_id}/commands/shopping.group.set_member

  • Command
  • Rigel runs it
  • Applies offline

Does nothing when the product is already in the group (or already out of it).

Parameters#

Put a product in a group or take it out: 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.

Put a product in a group or take it out: request body fields
FieldDescription
group_idstringrequired

The group.

product_idstringrequired

The product.

is_memberbooleanrequired

True to put the product in the group, false to take it out.

Response#

200 The command was applied.

Put a product in a group or take it out: 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.

Put a product in a group or take it out: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404group_not_foundA group that isn't there.
404product_not_foundA product that isn't there.
404not_foundThe household doesn't exist, or you aren't a member of it.
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.

Adds a product to a group

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": true
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    group_id: "pgr_01JC000000000000000000000A",
    product_id: "prd_01JC000000000000000000000A",
    is_member: true,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": true
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0DMZZ0V1112BWYR4B

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

Adding a member twice writes nothing

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": true
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    group_id: "pgr_01JC000000000000000000000A",
    product_id: "prd_01JC000000000000000000000A",
    is_member: true,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": true
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0FFZMPFSYA91FXJMD

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

Takes a product out

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": false
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    group_id: "pgr_01JC000000000000000000000A",
    product_id: "prd_01JC000000000000000000000A",
    is_member: false,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": false
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0C08N1VRTQH6VYHCP

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

Removing a non-member writes nothing

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": false
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    group_id: "pgr_01JC000000000000000000000A",
    product_id: "prd_01JC000000000000000000000A",
    is_member: false,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": false
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0J0HMJ2H5H8SF0HDK

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

A group that isn't there

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": true
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    group_id: "pgr_01JC000000000000000000000A",
    product_id: "prd_01JC000000000000000000000A",
    is_member: true,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": true
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0WCMFPAHZRCQ9ZT8C

{
  "error": {
    "code": "group_not_found",
    "message": "That product group isn't there any more. No changes were applied.",
    "details": {
      "group_id": "pgr_01JC000000000000000000000A"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0WCMFPAHZRCQ9ZT8C"
  }
}

A product that isn't there

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": true
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    group_id: "pgr_01JC000000000000000000000A",
    product_id: "prd_01JC000000000000000000000A",
    is_member: true,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.group.set_member HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "group_id": "pgr_01JC000000000000000000000A",
  "product_id": "prd_01JC000000000000000000000A",
  "is_member": true
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0XDQDBVZRS0WA7B6Y

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

Put a product in a group

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/shopping.group.set_member' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01M6V9CT7A1KQMXFSM3FYETS6W' \
  -d '{
  "group_id": "pgr_01M6V9CT7846PSF8VHM36ZGEQV",
  "product_id": "prd_01M6V9CSWCK03ABGA7BSJA03Q1",
  "is_member": true
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/shopping.group.set_member", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01M6V9CT7A1KQMXFSM3FYETS6W",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    group_id: "pgr_01M6V9CT7846PSF8VHM36ZGEQV",
    product_id: "prd_01M6V9CSWCK03ABGA7BSJA03Q1",
    is_member: true,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/shopping.group.set_member HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CT7A1KQMXFSM3FYETS6W

{
  "group_id": "pgr_01M6V9CT7846PSF8VHM36ZGEQV",
  "product_id": "prd_01M6V9CSWCK03ABGA7BSJA03Q1",
  "is_member": true
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CT7ABWAG10844T1Y4BMX

{
  "result": {},
  "version": 271
}

For Rigel#

Rigel's tool for this command is shopping_group_set_member. 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