---
title: "Demand"
url: "https://dev.4hse.com/api/demand"
---

# Demand

A **Demand** represents a compliance requirement: the link between a preventive action and a work group that requires that action. It indicates that a specific work group (job role, work phase, or homogeneous group) needs a specific action (training, maintenance, check, etc.).

For example: a Demand linking the action “Fire Safety Training” to the work group “Welders” means that welders need that training course.

Demands can be linked to risks via RiskDemand, establishing that an action mitigates a specific risk.

Use this API to:

-   Define which actions are required by which work groups
-   Find all requirements for a work group (filter by `resource_id` with the `work_group_id`)
-   Find all work groups that require an action (filter by `action_id`)

The combination of `action_id` + `resource_id` must be unique.

Supports historicization.

Version

2.0.0

OpenAPI version

3.0.0

## Authentication

[Section titled “ Authentication ”](#authentication)

### OAuth2

[Section titled “OAuth2 ”](#oauth2)

**Security scheme type:** oauth2

**Flow type:** password

**Token URL:** [https://auth.4hse.com/realms/4hse/protocol/openid-connect/token](https://auth.4hse.com/realms/4hse/protocol/openid-connect/token)

### AccessToken

[Section titled “AccessToken ”](#accesstoken)

**Security scheme type:** apiKey

**Query parameter name:** access-token

## Operations

[Section titled “Operations”](#operations)

### index

[Section titled “index”](#operation-indexDemand-post)

POST

/v2/demand/index

-   

Returns a paginated list of demands.

Most useful filters:

-   `resource_id` (work\_group\_id): all requirements for a specific work group
-   `action_id`: all work groups that require a specific action
-   `action_type`: filter by action type

## Authorizations

[Section titled “Authorizations ”](#authorizations)

-   **[OAuth2](/api/demand/#oauth2)**
-   **[AccessToken](/api/demand/#accesstoken)**

#### Request Body

[Section titled “Request Body ”](#request-body)

Parameters for searching demands

Select media typeapplication/json

object

**filter**

object

**demand\_id**

string format: uuid

**action\_id**

string format: uuid

**action\_type**

string

Allowed values: TRAINING MAINTENANCE HEALTH CHECK PER

**resource\_id**

string format: uuid

**resource\_type**

string

**data**

object

**action\_code**

Code of the required action.

string

**action\_name**

Name of the required action.

string

**resource\_code**

Code of the work group.

string

**resource\_name**

Name of the work group.

string

**office\_id**

string format: uuid

**project\_id**

string format: uuid

**owned\_active**

Whether this demand is currently active.

boolean

nullable

**parent\_active**

Whether the parent entities are currently active.

boolean

nullable

**per-page**

integer

default: 100 \>= 1

**page**

integer

default: 1 \>= 1

**sort**

string

Allowed values: action\_code action\_name action\_type resource\_code resource\_name resource\_type

**history**

If true, includes historicized entries.

boolean

##### Example

```
{  "filter": {    "resource_id": "3a4b5c6d-7e8f-9012-abcd-ef3456789012",    "action_type": "TRAINING"  },  "per-page": 20,  "page": 1,  "sort": "action_name"}
```

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

List of demands

Select media typeapplication/json

Array<object>

object

**demand\_id**

string format: uuid

**action\_id**

string format: uuid

**action\_type**

string

Allowed values: TRAINING MAINTENANCE HEALTH CHECK PER

**resource\_id**

string format: uuid

**resource\_type**

string

**data**

object

**action\_code**

Code of the required action.

string

**action\_name**

Name of the required action.

string

**resource\_code**

Code of the work group.

string

**resource\_name**

Name of the work group.

string

**office\_id**

string format: uuid

**project\_id**

string format: uuid

**owned\_active**

Whether this demand is currently active.

boolean

nullable

**parent\_active**

Whether the parent entities are currently active.

boolean

nullable

#### Headers

[Section titled “Headers ”](#headers)

**X-Pagination-Current-Page**

integer

Current page

**X-Pagination-Page-Count**

integer

Total number of pages

**X-Pagination-Per-Page**

integer

Number of items per page

**X-Pagination-Total-Count**

integer

Total number of items

### create

[Section titled “create”](#operation-createDemand-post)

POST

/v2/demand/create

-   

Creates a new demand.

Requires `action_id`, `action_type`, `resource_id`, and `resource_type`. The `demand_id` is auto-generated if not provided.

The action and work group must belong to the same office.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

-   **[OAuth2](/api/demand/#oauth2)**
-   **[AccessToken](/api/demand/#accesstoken)**

#### Request Body required

[Section titled “Request Body required ”](#request-body)

Demand to create

Select media typeapplication/json

object

**demand\_id**

Unique identifier. Auto-generated if not provided.

string format: uuid

**action\_id**

required

The required action. Pass the `action_id` from the Action API.

string format: uuid

**action\_type**

required

Type of the required action.

string

Allowed values: TRAINING MAINTENANCE HEALTH CHECK PER

**resource\_id**

required

The work group that requires this action. Pass the `work_group_id` from the WorkGroup API.

string format: uuid

**resource\_type**

required

Type of resource. Use `WORK_GROUP`.

string

Allowed values: WORK\_GROUP

**data**

Additional structured data in JSON format.

object

#### Responses

[Section titled “ Responses ”](#responses)

##### 201

[Section titled “201 ”](#201)

Demand created successfully

Select media typeapplication/json

object

**demand\_id**

Unique identifier. Auto-generated if not provided.

string format: uuid

**action\_id**

required

The required action. Pass the `action_id` from the Action API.

string format: uuid

**action\_type**

required

Type of the required action.

string

Allowed values: TRAINING MAINTENANCE HEALTH CHECK PER

**resource\_id**

required

The work group that requires this action. Pass the `work_group_id` from the WorkGroup API.

string format: uuid

**resource\_type**

required

Type of resource. Use `WORK_GROUP`.

string

Allowed values: WORK\_GROUP

**data**

Additional structured data in JSON format.

object

### view

[Section titled “view”](#operation-viewDemand-get)

GET

/v2/demand/view/{id}

-   

Retrieves a single demand by its ID.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

-   **[OAuth2](/api/demand/#oauth2)**
-   **[AccessToken](/api/demand/#accesstoken)**

#### Path Parameters

[Section titled “Path Parameters ”](#path-parameters)

**id**

required

string format: uuid

The demand\_id to retrieve.

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

Demand found

Select media typeapplication/json

object

**demand\_id**

string format: uuid

**action\_id**

string format: uuid

**action\_type**

string

Allowed values: TRAINING MAINTENANCE HEALTH CHECK PER

**resource\_id**

string format: uuid

**resource\_type**

string

**data**

object

**action\_code**

Code of the required action.

string

**action\_name**

Name of the required action.

string

**resource\_code**

Code of the work group.

string

**resource\_name**

Name of the work group.

string

**office\_id**

string format: uuid

**project\_id**

string format: uuid

**owned\_active**

Whether this demand is currently active.

boolean

nullable

**parent\_active**

Whether the parent entities are currently active.

boolean

nullable

##### 404

[Section titled “404 ”](#404)

Demand not found

### update

[Section titled “update”](#operation-updateDemand-put)

PUT

/v2/demand/update/{id}

-   

Updates an existing demand.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

-   **[OAuth2](/api/demand/#oauth2)**
-   **[AccessToken](/api/demand/#accesstoken)**

#### Path Parameters

[Section titled “Path Parameters ”](#path-parameters)

**id**

required

string format: uuid

The demand\_id to update.

#### Request Body required

[Section titled “Request Body required ”](#request-body)

Fields to update

Select media typeapplication/json

object

**demand\_id**

Unique identifier. Auto-generated if not provided.

string format: uuid

**action\_id**

required

The required action. Pass the `action_id` from the Action API.

string format: uuid

**action\_type**

required

Type of the required action.

string

Allowed values: TRAINING MAINTENANCE HEALTH CHECK PER

**resource\_id**

required

The work group that requires this action. Pass the `work_group_id` from the WorkGroup API.

string format: uuid

**resource\_type**

required

Type of resource. Use `WORK_GROUP`.

string

Allowed values: WORK\_GROUP

**data**

Additional structured data in JSON format.

object

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

Demand updated successfully

Select media typeapplication/json

object

**demand\_id**

Unique identifier. Auto-generated if not provided.

string format: uuid

**action\_id**

required

The required action. Pass the `action_id` from the Action API.

string format: uuid

**action\_type**

required

Type of the required action.

string

Allowed values: TRAINING MAINTENANCE HEALTH CHECK PER

**resource\_id**

required

The work group that requires this action. Pass the `work_group_id` from the WorkGroup API.

string format: uuid

**resource\_type**

required

Type of resource. Use `WORK_GROUP`.

string

Allowed values: WORK\_GROUP

**data**

Additional structured data in JSON format.

object

##### 404

[Section titled “404 ”](#404)

Demand not found

### delete

[Section titled “delete”](#operation-deleteDemand-delete)

DELETE

/v2/demand/delete/{id}

-   

Deletes a demand.

If `force=false` (default), the response lists child entities (RiskDemand links). If `force=true`, the demand and all related entities are deleted.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

-   **[OAuth2](/api/demand/#oauth2)**
-   **[AccessToken](/api/demand/#accesstoken)**

#### Path Parameters

[Section titled “Path Parameters ”](#path-parameters)

**id**

required

string format: uuid

The demand\_id to delete.

#### Query Parameters

[Section titled “Query Parameters ”](#query-parameters)

**force**

boolean

If true, deletes the demand and all child entities.

#### Responses

[Section titled “ Responses ”](#responses)

##### 204

[Section titled “204 ”](#204)

Demand deleted successfully

##### 400

[Section titled “400 ”](#400)

Preview of entities that would be deleted (returned when force=false)

This site is protected by reCAPTCHA and the Google [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms) apply.