When to use this. Sample types are the admin building blocks that power sample requests on styles.
You define them once (e.g. “Proto sample”, “Sales sample”); the server gives each one a display
position that reflects the sequence of your sampling process. You then select them when creating
sample requests on any style. A sample type
cannot be selected for new requests if it is inactive, and it cannot be deleted once it has been
used in a sample request. Configure these before you start working with styles.
The workflow
A sample type is an organisation-level record. The usual path is to create the sample types, set up notification preferences for each, reference them on styles, and optionally use season milestones to anchor deadlines.1
Create sample types
POST /api/sample-types with the name, state, optional comment deadline, and notification
settings. The server assigns a display position automatically.2
Configure notifications
Each sample type carries a
notifySettings list: the sample-request statuses that trigger
an email to the supplier contact when a request is set to that status. Pass the desired
statuses in the body, or omit the field (or send null) to use the default of every status
except planned.3
List and filter
GET /api/sample-types with optional filters (State, Search, Names) to retrieve
the current set. Use State=active to see only types available for new sample requests.
Fetch a single sample type with GET /api/sample-types/{id}.4
Retire or delete
PUT /api/sample-types/{id} to deactivate a sample type by setting state to inactive.
PUT is a full replace: send name, state, commentDeadline and notifySettings as they
should end up, because an omitted commentDeadline or notifySettings is cleared.
To change one field and keep the rest, use PATCH /api/sample-types/{id} instead.
To delete one that has never been used, call DELETE /api/sample-types/{id}.
Bulk operations (update and delete in one call) are available via PUT /api/sample-types.Walkthrough
Create a new sample type called “Salesman sample” with a 5-day comment deadline and four notification statuses. The body is an array: one or many sample types are created in a single all-or-nothing transaction.id:
sample requests on styles reference sample types by it.
Field reference
For a partial update,
PATCH /api/sample-types/{id} accepts an RFC 6902 JSON Patch document
(Content-Type: application/json-patch+json) and touches only the paths you send: /name,
/state, /commentDeadline and /notifySettings; every field you omit keeps its current value.
A replace of /commentDeadline to null clears the deadline. A touched /notifySettings is
the full set of notifying statuses ([] means none notify). name cannot be cleared and
state cannot be removed (400), state cannot be set to deleted (use
DELETE /api/sample-types/{id}), and position is server-controlled, so touching it is
rejected.Roles & permissions
Managing sample types requires admin-levelsample_types permission on a designer (brand)
account: by default, CompanyAdmin. Supplier accounts collaborate on sample requests on styles but do not
manage a brand’s sample type configuration.
When things go wrong
Errors use the standard envelope (status: "error", a code, and error.details[]). See
Errors & responses for the full list of codes and how to resolve them.
Common cases:
- 400:
validation_error.required_fieldifnameis missing. - 400: attempting to delete a sample type that is in use by a sample request.
- 403: the
{id}belongs to a different organisation. - 404:
resource_error.sample_type_not_foundif the{id}exists in no organisation. - 409:
resource_conflict_error.sample_type_already_existsif the name already exists in the organisation. - 409: a JSON Patch
testoperation fails onPATCH /api/sample-types/{id}. - 422: any other JSON Patch operation that cannot be applied.
What to call next
Seasons
Assign milestone dates per sample type on each season so deadlines appear automatically on new sample requests.
Size ranges
Size ranges are required before creating sample requests on styles: set them up alongside sample types.
Style categories
Organise styles, the home of sample requests, by category.