# Upsert location rule set

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

Endpoint: PUT /settings/location-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):

  - `id` (string)
    Example: cb1fb12c-0abc-413c-a69d-63c62566685f

  - `name` (string, required)
    The name of the location rule set
    Example: DC stop time rules

  - `location_rules` (array, required)
    Each `location rule` has one or more conditions. A `location rule` has it's `effects` applied when at least one of its `conditions` is satisfied.

  - `location_rules.name` (string, required)
    The name of the `location rule`
    Example: Extra stop time at distribution center

  - `location_rules.conditions` (array, required)
    `Conditions` to match locations. A `condition` matches when both the location filter and the previous location filter match. At least one `condition` is required.

  - `location_rules.conditions.locations` (object, required)

  - `location_rules.conditions.locations.label` (string)
    The locations to target. A location will match when it has a matching label.
This field is required for INCLUDING and EXCLUDING operators, must not be set for ALL
    Example: DISTRIBUTION_CENTER

  - `location_rules.conditions.locations.operator` (string, required)
    Filter operator that determines how locations are matched. ALL matches any location, INCLUDING and EXCLUDING requires a label.
    Enum: "ALL", "INCLUDING", "EXCLUDING"

  - `location_rules.effects` (object, required)
    Effects to apply to the locations when a location rule matches

  - `location_rules.effects.stop_time` (object, required)
    When a `location rule` matches, it applies a stop time with two optional components. 
When both factor and extra are provided, the factor is applied first, then the extra duration is added. When multiple rules match the same stop, all factors are multiplied together before the sum of all extra durations is added.

  - `location_rules.effects.stop_time.extra` (string)
    Extra stop time in ISO-8601 duration format. Must be non-negative and not exceed 7 days.
    Example: PT15M

  - `location_rules.effects.stop_time.factor` (number)
    Factor to multiply the stop time by. Must be non-negative.
    Example: 1.5

## Response 201:

  - `201` (unknown)
    location 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)
    location 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.

