List a module's custom field definitions
const url = 'https://safe-api.safetyradar.com/v2/modules/action_item/fields';const options = { method: 'GET', headers: {'x-team': 'my-team-slug', Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://safe-api.safetyradar.com/v2/modules/action_item/fields \ --header 'Authorization: Bearer <token>' \ --header 'x-team: my-team-slug'Get your organization’s active custom-field definitions for a module — the contract behind the fields envelope on that module’s records. action_item is the module behind /action-items.
Retired definitions are omitted, as are archived options: both stay valid on records that already hold them, so a value you read back from a record may not appear in this list. Each field’s ops are the filter operators it accepts in fieldFilters on the record listing, and its logic is the conditional behaviour the server enforces on write.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The module’s slug. Core modules are seeded; action_item is the module behind /action-items. Note the underscore.
Example
action_itemThe module’s slug. Core modules are seeded; action_item is the module behind /action-items. Note the underscore.
Header Parameters
Section titled “Header Parameters”Deprecated — accepted but ignored; the v2 API is org-scoped.
Example
my-team-slugDeprecated — accepted but ignored; the v2 API is org-scoped.
Responses
Section titled “Responses”The organization’s active field definitions for this module
object
object
The key this field takes in the fields envelope. Immutable once any record holds a value.
date is YYYY-MM-DD, datetime is ISO 8601, user and asset are UUIDs of a user / asset in your organization, and multi_enum takes an array of option values.
Enforced on create. On a partial update it is enforced only for keys you actually send.
Selectable options for enum / multi_enum, null for every other type. Archived options are omitted: they are no longer offered, but records that already hold one stay valid, so a value you read back may not appear here.
object
Type-appropriate limits, null when the field has none.
object
object
For offset: the base the day count is added to.
object
For field: the key of the field whose value is compared.
For token: the moment of evaluation.
For offset: whole days, negative for before.
object
For offset: the base the day count is added to.
object
For field: the key of the field whose value is compared.
For token: the moment of evaluation.
For offset: whole days, negative for before.
Conditional behaviour, null when the field has none. visibility shows the field only while its condition holds; requiredWhen requires it while its condition holds, on top of required. A hidden field is never required, so a condition can never make a record unsaveable through a control you cannot see.
object
Show the field only while this condition holds.
object
The key of another field on this same module, evaluated against the record’s fields envelope. Absent for always, and, or and not.
The operand for eq, neq, gt, gte, lt and lte — a literal, or a dynamic operand (another field’s value, today/now, either pushed by whole days).
object
For offset: the base the day count is added to.
object
For field: the key of the field whose value is compared.
For token: the moment of evaluation.
For offset: whole days, negative for before.
The operand list for in and notIn.
Nested conditions of this same shape, for and and or.
The nested condition of this same shape, for not.
object
The key of another field on this same module, evaluated against the record’s fields envelope. Absent for always, and, or and not.
The operand for eq, neq, gt, gte, lt and lte — a literal, or a dynamic operand (another field’s value, today/now, either pushed by whole days).
object
For offset: the base the day count is added to.
object
For field: the key of the field whose value is compared.
For token: the moment of evaluation.
For offset: whole days, negative for before.
The operand list for in and notIn.
Nested conditions of this same shape, for and and or.
The nested condition of this same shape, for not.
Applied on CREATE to a key you do not send, null when the field has none. Published because a condition can READ a defaulted field: leave the key out and the server evaluates the condition against this value, not against an unanswered one.
Display order within the module.
Section heading this field is grouped under, null when ungrouped.
The filter operators this field accepts in fieldFilters on the record listing. isNull / isNotNull take no value; in takes an array.
Example
{ "data": [ { "key": "crew", "label": "Crew", "type": "string", "constraints": { "minDate": { "kind": "field", "token": "today", "from": { "kind": "field", "key": "due_date", "token": "today" }, "days": 14 }, "maxDate": { "kind": "field", "token": "today", "from": { "kind": "field", "key": "due_date", "token": "today" }, "days": 14 } }, "logic": { "visibility": { "op": "always", "fieldId": "severity", "value": { "kind": "field", "token": "today", "from": { "kind": "field", "key": "due_date", "token": "today" }, "days": 14 } }, "requiredWhen": { "op": "always", "fieldId": "severity", "value": { "kind": "field", "token": "today", "from": { "kind": "field", "key": "due_date", "token": "today" }, "days": 14 } } }, "ops": [ "eq", "neq", "in", "isNull", "isNotNull" ] } ]}Unauthorized
object
object
Examplegenerated
{ "code": "example", "message": "example", "details": { "additionalProperty": "example" }}No module with this slug is available to your organization
object
object
Examplegenerated
{ "code": "example", "message": "example", "details": { "additionalProperty": "example" }}
