Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Retail Store Groups

Administrative endpoints for retail store groups — named groups of retail stores. A store belongs to at most one group (the store's group field), and a group is identified across the platform by its unique slug.

Groups are used by the scheduled-delivery (slot) features:

  • Schedules are assigned to retail store groups. When delivery slots are generated or validated for a scheduled delivery, only the schedules of the delivery's retail store group are considered.

  • Slot suspenders with the retail_store_group rule match stores by the slug of their group (see the Slot Suspenders section).

Core Capabilities

1. Listing & Filtering

  • Retrieve the list of retail store groups. All matching groups are returned in a single page (see Pagination).

  • Filter by name; order with the sort parameter.

2. Group Lifecycle Management

  • Create a group and assign its stores in the same request.

  • Retrieve a single group.

  • Fully (PUT) or partially (PATCH) update a group, including its store membership (see Store Membership).

  • Delete a group that has no stores (see Deleting a Retail Store Group).

Retail Store Group Fields

Field
Type
Description

pk

integer

The unique identifier of the group. Read-only.

name

string (max 255)

The group name. Required on create and full update. Not unique.

slug

string (max 64)

The unique identifier of the group, made of letters, numbers, underscores, or hyphens. Required on create and full update; it is not generated from name. Referenced by slot suspender rules.

is_active

boolean

Whether the group is active. Defaults to true (see Form-Encoded Requests for an exception). Stored and returned only — it is not checked when schedules or slot suspender rules are matched to a group.

stores

array of integer

The identifiers of the retail stores in the group. Required on create and full update; an empty list is accepted.

schedules

array of integer

Read-only. The identifiers of the schedules assigned to the group. Schedules are assigned through the schedules endpoints; a value sent here is ignored.

Store Membership

Store membership is stored on the store (each store has a single group), so writing stores changes the stores themselves:

  • Create assigns every listed store to the new group.

  • Update (PUT, or PATCH with stores) makes the listed stores the group's exact members — listed stores are assigned to the group, and stores of the group that are not listed are detached from it (their group becomes null). A PATCH without stores leaves the membership unchanged.

  • A store that already belongs to another group is moved to this group and silently leaves its previous group.

  • Every identifier must belong to an existing retail store; an unknown identifier is rejected with 400.

Form-Encoded Requests

The write operations also accept multipart/form-data and application/x-www-form-urlencoded bodies. In a form-encoded create or full update (PUT), fields that are left out are not treated as missing:

  • A missing stores is read as an empty list instead of being rejected — on PUT this detaches every store from the group.

  • A missing is_active is read as false.

A form-encoded PATCH keeps the stored value of every field it leaves out. Send stores and is_active explicitly, or use JSON.

Pagination

This endpoint returns all matching groups in a single page; the page and limit parameters are accepted for envelope consistency but do not paginate the result. The response keeps the standard {count, next, previous, results} shape, with next and previous always null.

Deleting a Retail Store Group

Important: DELETE /retailstoregroups/{id}/ is a hard delete. A group that still has at least one store is rejected with 400; the response body is a plain list of messages (["Retail store group has at least one retail store."]), not a field-keyed object. Remove the stores first — for example with a PATCH that sends "stores": []. Deleting a group also removes it from every schedule it was assigned to.

Filtering & Ordering

Parameter
Match

name

Exact, case-sensitive match on the group name.

No default ordering is applied. Use the sort parameter to order the results (for example sort=name or sort=-pk); prefix a field with a hyphen for descending order.

Dynamic Settings & Environment Variables

No dynamic setting changes the request or response schema of these endpoints, and no environment variables are read directly. The setting below affects their side effects. It is referenced again in the description of the operation it affects.

Key
Type
Default
Effect

IGNORE_DELETED_ITEMS_SIGNAL

array of strings

["django_audit_events.AuditEvent", "django_audit_events.ArchivedAuditEvent", "sessions.Session", "datawarehouse.DeletedItem"]

The model labels excluded from delete tracking. Affects delete: unless address.RetailStoreGroup is added to this list, deleting a group also records a deleted-item entry, which is exposed through the data-warehouse deleted-items endpoint. The API response is identical either way.

Last updated

Was this helpful?