# Upsert time window rule set

Create or update a time window rule set. A unique ID is required to identify the time window rule set.
Calling this endpoint with an existing ID will update the time window rule set.

Endpoint: PUT /settings/time-window-rule-sets/{id}
Version: 1.28.1
Security: clientCredentials

## Security:

  - `clientCredentials` (unknown)
    oauth2

## Path parameters:

  - `id` (string, required)
    The unique identifier of an entity

## Header parameters:

  - `If-Match` (string)
    Weak Etag used for optimistic locking.

## Request fields (application/json):

  - `name` (string, required)
    The name of the time window rule set
    Example: City centre curfew

  - `rules` (array, required)
    The rules in this set. May be empty.

  - `rules.name` (string, required)
    The name of the rule
    Example: no daytime access

  - `rules.order_condition` (object, required)
    Selects the orders a rule applies to by a single label.

  - `rules.order_condition.operator` (string, required)
    The operator used to match orders against the label.
- `INCLUDING`
 — the rule applies to orders carrying the label.
- `EXCLUDING`
 — the rule applies to orders not carrying the label.
    Enum: "INCLUDING", "EXCLUDING"

  - `rules.order_condition.label` (string, required)
    The time window label the rule matches on.
    Example: city-centre

  - `rules.day_groups` (array, required)
    The day groups of the rule. Within a rule, a weekday belongs to at most one day group.

  - `rules.day_groups.name` (string, required)
    The name of the day group
    Example: weekdays

  - `rules.day_groups.days` (array, required)
    The weekdays this group covers.
    Example: ["MONDAY","TUESDAY"]

  - `rules.day_groups.schedule` (object, required)
    When visits are permitted on the day group. Either open all day, or a list of explicit windows.
A period no window covers is closed.

  - `rules.day_groups.schedule.type` (string, required)
    Enum: "OPEN_ALL_DAY", "WINDOWS"

  - `rules.day_groups.schedule.windows` (array, required)
    The explicit windows during which visits are permitted.

  - `rules.day_groups.schedule.windows.start` (string, required)
    The time of day the window opens, as HH:mm.
    Example: 12:00

  - `rules.day_groups.schedule.windows.end` (string, required)
    The time of day the window closes, as HH:mm.
    Example: 13:00

  - `rules.day_groups.schedule.windows.ends_on` (integer, required)
    The day offset the window ends on, relative to the day it starts. 0 is the same day.
    Example: 0

  - `rules.day_groups.schedule.windows.cost` (integer)
    The cost of visiting within this window. Optional, defaults to 0.
    Example: 100

## Response 201:

  - `201` (unknown)
    time window rule set created successfully

## Response 201 headers:

  - `ETag` (string)
    A weak Etag (ex `W/"<etag_value>"`) which contains the current version of the entity
    Example: W/"25"

## Response 204:

  - `204` (unknown)
    time window rule set updated successfully

## Response 204 headers:

  - `ETag` (string)
    A weak Etag (ex `W/"<etag_value>"`) which contains the current version of the entity
    Example: W/"25"

## Response 400:

  - `400` (unknown)
    Bad request

## Response 400 fields (application/problem+json):

  - `type` (string, required)
    An absolute URI that identifies the problem type.  When dereferenced,
it SHOULD provide human-readable documentation for the problem type
(e.g., using HTML).
    Example: https://developer.conundra.eu/developer-portal/problem/#constraint-violation

  - `title` (string, required)
    A short, summary of the problem type. Written in english and readable
for engineers (usually not suited for non technical stakeholders and
not localized)
    Example: Bad Request

  - `status` (integer, required)
    The HTTP status code generated by the origin server for this occurrence
of the problem.
    Example: 400

  - `detail` (string, required)
    A human readable explanation specific to this occurrence of the
problem.
    Example: Bad request. See violations for more details.

  - `violations` (array)

  - `violations.field` (string)
    A reference to the field in the request that triggered this violation.
    Example: limit

  - `violations.message` (string, required)
    A message explaining the violation in the referenced field.
    Example: Limit must be strictly positive.

## Response 401:

  - `401` (unknown)
    Authentication required

## Response 412:

  - `412` (unknown)
    This status is returned when an entity is updated with an outdated version in the If-Match header.

## Response 412 fields (application/problem+json):

  - `type` (string, required)
    An absolute URI that identifies the problem type.  When dereferenced,
it SHOULD provide human-readable documentation for the problem type
(e.g., using HTML).
    Example: https://developer.conundra.eu/developer-portal/problem/#constraint-violation

  - `title` (string, required)
    A short, summary of the problem type. Written in english and readable
for engineers (usually not suited for non technical stakeholders and
not localized)
    Example: Bad Request

  - `status` (integer, required)
    The HTTP status code generated by the origin server for this occurrence
of the problem.
    Example: 400

  - `detail` (string, required)
    A human readable explanation specific to this occurrence of the
problem.
    Example: Bad request. See violations for more details.

  - `violations` (array)

  - `violations.field` (string)
    A reference to the field in the request that triggered this violation.
    Example: limit

  - `violations.message` (string, required)
    A message explaining the violation in the referenced field.
    Example: Limit must be strictly positive.

