#### URL Expired

The URL for this request expired after 30 days.

The bulk demand creation endpoint was designed to create daily demand for a given period, location, and role.

## Fields

Here's a description of the fields allowed for the endpoint:

- `externalId (string)(optional)`: the id of the demand from an external service.
- `name (string)(optional)`: the demand name.
- `locationUuid (string)`: the uuid of the location to create the demand in.
- `jobUuid (string)`: the uuid of the job to create the demand for.
- `startDate (string)`: date to start creating demand.
- `endDate (string)`: date to stop creating demand.
- `daysOfWeek (number[])`: The days of the week to create the demand in (0 is Sunday, 6 is Saturday)
- `headcountChanges (array)`: The headcount changes across the day (at least one change is required)

- `startTime (string)`: The time in which the headcount change takes place. _The date from the datetime string is not important. Only the datetime is._
  - `endTime (string)(optional - will default to EOD if not provided)`: The time in which the headcount change ends. _The date from the datetime string is not important. Only the datetime is._
  - `minimumHeadcount (number)`: The minimum headcount of the change. _0 is the minimum._
  - `maximumHeadcount (number)(optional)`: The maximum headcount of the change. _0 is the minimum._

## Examples

### Example 1

```shell
curl --location '<environment_url>/api/serviceattendance/processes/demand/bulkCreate' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <insert_token>' \
--data '{
    "locationUuid": "c349681c-3567-4010-b45c-38b3622c02af",
    "jobUuid": "58907792-980f-4cc0-bed7-38ea0d08b8df",
    "startDate": "2025-04-14T00:00:00Z",
    "endDate": "2025-04-19T00:00:00Z",
    "daysOfWeek": [1, 3, 5],
    "headcountChanges": [
        {
            "startTime": "2025-04-07T09:00:00.000",
            "endTime": "2025-04-07T16:00:00.000",
            "minimumHeadcount": 2
        }
    ]
}'
```

`2025-04-14` falls on Monday and `2025-04-19` falls on Saturday. Since we're passing [1, 3, 5] (Monday, Wednesday, and Friday) as the value for `daysOfWeek`, demand will be created for those three days only. And since there's only one headcount change that goes from 9 am to 4 pm, this will mean that on Monday, Wednesday and Friday you'll need **at least 2** workers between 9 am and 4 pm.

### Example 2

```shell
curl --location '<environment_url>/api/serviceattendance/processes/demand/bulkCreate' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <insert_token>' \
--data '{
    "locationUuid": "c349681c-3567-4010-b45c-38b3622c02af",
    "jobUuid": "58907792-980f-4cc0-bed7-38ea0d08b8df",
    "startDate": "2025-04-14T00:00:00Z",
    "endDate": "2025-04-19T00:00:00Z",
    "daysOfWeek": [1, 3, 5],
    "headcountChanges": [
        {
            "startTime": "2025-04-07T09:00:00.000",
            "endTime": "2025-04-07T12:00:00.000",
            "minimumHeadcount": 3
        },
        {
            "startTime": "2025-04-07T12:00:00.000",
            "endTime": "2025-04-07T15:00:00.000",
            "minimumHeadcount": 0
        },
        {
            "startTime": "2025-04-07T15:00:00.000",
            "minimumHeadcount": 1
        }
    ]
}'
```

Demand will be created for the same days as the previous example (Monday, Wednesday, and Friday). In this case, there are three headcount changes for the demand:

- From 9 am to 12 pm, there need to be at least 3 workers at the same time.
- From 12 pm to 3 pm, there shouldn't be ANY workers scheduled.
- From 3 pm until the end of the day, there needs to be at least 1 worker scheduled at all times.
