Skip to main content
POST
/
rules
/
v1
/
rs
/
training
Create training rule (custom or library)
curl --request POST \
  --url https://z52mnqg347.execute-api.eu-west-3.amazonaws.com/main/rules/v1/rs/training \
  --header 'Authorization: Bearer <token>' \
  --header 'content-type: <content-type>' \
  --header 'x-session-token: <x-session-token>' \
  --data '
{
  "name": "Annual Safety Check",
  "sourceType": 1,
  "rrule": "FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=1",
  "workflowType": 1,
  "complianceType": 1,
  "description": "This rule requires an annual safety check for all installations.",
  "links": [
    {
      "name": "Rule Details",
      "url": "https://example.com/rule-details"
    }
  ],
  "establishmentCategories": [
    1,
    2,
    3
  ],
  "establishmentClassifications": [
    "ERP",
    "IGH",
    "HAB"
  ],
  "establishmentTypes": [
    "J",
    "P",
    "EF"
  ],
  "companyTypes": [
    3
  ]
}
'
{
  "rule": {
    "id": 1,
    "name": "Annual Safety Check",
    "description": "This rule requires an annual safety check for all installations.",
    "type": 2,
    "sourceType": 1,
    "links": [
      {
        "name": "Rule Details",
        "url": "https://example.com/rule-details"
      }
    ],
    "rrule": "FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=1",
    "workflowType": 1,
    "complianceType": 1,
    "establishmentCategories": [
      1,
      2,
      3
    ],
    "establishmentClassifications": [
      "ERP",
      "IGH",
      "HAB"
    ],
    "establishmentTypes": [
      "J",
      "P",
      "EF"
    ],
    "archivedAt": "2024-12-10T10:00:00.000Z",
    "updatedAt": "2024-12-05T14:56:23.000Z",
    "createdAt": "2024-01-15T08:45:00.000Z",
    "companyTypes": [
      3
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

content-type
string
required

Content type, must be "application/json".

Allowed value: "application/json"
x-session-token
string
required

Session token used for authenticating the request.

Example:

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjM0NTY3ODkwIiwic2Vzc2lvbklkIjoiYWJjZGVmMTIzNDU2IiwiaWF0IjoxNjA1MDk3ODk5LCJleHAiOjE2MDUxODQyOTl9.4XRQ1iXDyvEj5LgPZHbmTmzOZs98M3YPOzgf3MhxjaI"

Body

application/json

Details required to create training rule

name
string
required

Name of the rule.

Required string length: 1 - 250
Example:

"Annual Safety Check"

sourceType
enum<number>
required

Source type of the rule (1: internal, 2: external).

Available options:
1,
2
Example:

1

rrule
string
required

Recurrence rule for the rule.

Required string length: 1 - 300
Example:

"FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=1"

workflowType
integer
required

Type of workflow (1: calendar-based, 2: regulatory).

Required range: -9007199254740991 <= x <= 9007199254740991
Example:

1

complianceType
integer
required

Type of compliance (1: register, 2: maintenance).

Required range: -9007199254740991 <= x <= 9007199254740991
Example:

1

description
string | null

Description of the rule.

Required string length: 1 - 2500
Example:

"This rule requires an annual safety check for all installations."

establishmentCategories
enum<number>[]

Categories of establishments concerned by the rule.

Available options:
1,
2,
3,
4,
5
Example:
[1, 2, 3]
establishmentClassifications
enum<string>[]

Classifications of establishments concerned by the rule.

Available options:
ERP,
ERT,
IGH,
HAB
Example:
["ERP", "IGH", "HAB"]
establishmentTypes
enum<string>[]

Types of establishments concerned by the rule.

Available options:
J,
L,
M,
N,
O,
P,
R,
S,
T,
U,
V,
W,
X,
Y,
OA,
GA,
PA,
CTS,
EF,
PS
Example:
["J", "P", "EF"]
companyTypes
number[]

Types of companies concerned by the rule

Example:
[3]

Response

201 - application/json

The training rule has been created

rule
object
required