---
title: "Update an existing Monitor."
method: PUT
path: "/fleets/{fid}/monitors/{mid}"
tags: ["Monitors"]
---

# Update an existing Monitor.

`PUT /fleets/{fid}/monitors/{mid}`

Update an existing ```Monitor``` that has been posted (and accepted previously) for this fleet. The monitor object (body) provided should be complete because the aggregation is not supported for the update of the ```monitor```. You can first retrieve this object using the ```GET /monitor/{mid}``` API, then modify it and finally publish it (via this ```PUT API```).

## Path parameters

- `mid` string, required
- `fid` string, required

## Request body

- MonitorParameter — MonitorParameter
  - `label` string, required — Monitor label (usually its name).
  - `subscribeParam` MonitorCallbackSubscribe, required — Monitor Callback subscription parameters.
    - `retryPolicy` object — The retry policy to apply when notification failed.
      - `policy` 'None' | 'Bounded' | 'Always', required — Defines the retry rules following a notification failure (ie the return code is not HTTP 2XX for WebHook mode). ```None``` means with a single try, ```Bounded``` with a limited number of tries and ```Always``` with an infinite number of tries.
      - `retryNumber` integer — Maximum number of attempts (to be used with a retryPolicy set to ```Bounded```).
      - `retryDelay` integer — Time to wait (expressed in seconds) before retrying to push a notification (ignored if retryPolicy is set to ```None```).
    - `batchNotify` object — Notification batch of events defined by a time window and batch size. If this field is not set, the callback will post only one event by call. * **At least, the ```size``` parameter should be provided.** * **If the time window is not set then the default value will be applied.**
      - `size` integer, required — Batch size (positive value and not zero).
      - `timeWindow` integer — Notification batch window size (expressed in seconds).
    - `callback` object, required
      - `webhook` Webhook, required — Defines the webhook for htp notification .
        - `target` string, required — URL format follows [RFC 3986](https://tools.ietf.org/html/rfc3986) and usually looks like this ` scheme://host[:port][/Path] `
        - `name` string, required — Webhook name.
        - `attributes` Attribute[] — Additional attributes-set as key/value pairs wich will be added to the request when sending the event. It can be used as http header enhancement (such as headers can be used as an authentication parameter when posting the event) or simply added to the notification event body (as set of key/values) or finally as additional query parameters.
          - `type` 'Header' | 'Body' | 'Query', required — 3 attributes type: |Attribute-type|Role| |----------|-------------| |Header|-Will be add as http header extension "x-######:"| |Body|-Will be simply add to event body map attribute (see monitor event definition in template document)| |Query|-Will set as http query parameter when invoking the Webhook|
          - `key` string, required
          - `value` union, required
            - string
            - 'vin' | 'monitorID' | 'fleetID' | 'vid' — A value that will be associated with the provided key as is if expressed as literal value or contextually valued if prefixed with the dollar sign ($). * Disclaimer: if the var "vin" is used as a query parameter, the batchnotify will be no more possible and each event will be sent through a separated request!. * example: Having a vin=VIN123456, the following attribute set: ```"attributes": [ { "type": "Header", "key": "X-vehicle-id" "value":"$vin" } ]``` will be valued as http header extension: *"X-vehicle-id: VIN123456"*
    - `refreshEvent` integer — Define the period (in sec.) between two refresh events. The refresh-events are sent when the condition of the monitor is satisfied (Trigger -> toggled true). A kind of periodic reminder.
  - `extendedEventParam` string[] — Allow to set extra vehicle data (defined in data model) to add to the monitor event when publishing. The possible values are : |value|description|Related model | |----------|:-------------|------:| |vehicle.doorsState|Latest known door state (timestamped) before the eventDate|DoorState| |vehicle.status|Latest known vehicle status (timestamped) before the eventDate|Status| |vehicle.maintenance|Latest known maintenance(timestamped) before the eventDate|Maintenance| |vehicle.position|Last vehicle position (timestamped) before the eventDate|Position| |vehicle.telemetry${.TelemetryEnum} |Latest known telemetry (timestamped) before the eventDate filtered with type|Telemetry |vehicle.alerts|List of active alerts at the eventDate|Alert| |vehicle.collisions|Latest known collisions before the eventDate|Collision| |vehicle.trip|Trip related to the event that triggers the notification|Trip| |vehicle.stolen|Vehicle Stolen context at the eventDate (only returns when vehicle is reported stolen) |Stolen| * For telemetry extension: * The suffix ```${.TelemetryEnum}``` can be selected to refine with telemetry type (from the TelemetryEnum list). This value (with suffix) can be selected **_several times_** to included suitable telemetry messages with the extention. * Using ```vehicle.telemetry``` without suffix means to include all available telemetries. * The set of data will then correspond to the union of extensions used in the request.
  - `triggerParam` object, required — Monitor trigger-param that allows to compound triggers by applying a boolean expression to evaluate them.
    - `triggers` MonitorTrigger[], required — Compound monitor triggers (will be evaluated using boolean expresion :```booExp```). At least, ```one``` trigger should be provided and at most, ```five``` items are accepted.
      - `name` string, required — The trigger name must be uniq and respect the following pattern
      - `zone` ZoneTrigger — Zone Alert parameter object
        - `transition` 'In' | 'Out', required — Zone monitoring type ('In' for monitoring entering zone and 'Out' for monitoring leaving zone),
        - `place` object, required — Circle zone is compound of a center point and a radius.
          - `radius` integer, required — Circle radius (expressed in km)
          - `center` object, required
            - `longitude` number, double, required
            - `latitude` number, double, required
      - `time` TimeTrigger — Temporal monitor for triggering vehicle moving event within a time interval.
        - `times` TimeTriggerEntry[], required
          - `recurrence` 'None' | 'Daily' — Determines the recurrence of the program. * None: means no recurrence. * Daily: repeated over the week.
          - `start` string, required — The start time. Its format depends on the recurrence value. * For ```None``` recurrence, the start time is considered as absolute time from when the monitor can trigger events. In this case the format should be compliante with [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) _example_: 2018-01-03T12:00:00+01:00 * For ```Daily``` recurrence, the start time formatted using the duration format based on [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Time_intervals) with the schema: P[n]Y[n]M[n]DT[n]H[n]M[n]S and whose value is between 00H and 23h59 _example_: PT14H30M : means 14H30min
          - `occurence` object — The occurrence on a bounded program will spread on months, weeks, days depending on recurrence value and ```week``` field.
            - `day` string[], required
            - `week` string[] — occurences over the weeks of the year from w1 to w52 specified in an array unitary or grouped by ranges (w1, w2, w34-w46, w52)
          - `duration` string — Duration of the monitor action expressed using [ISO-8601 Duration spec](https://en.wikipedia.org/wiki/ISO_8601#Durations). This field <b><u>is mandatory</u></b> if the recurrence is set to ```Daily```
        - `timeZone` string — The standard time [zone code](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) of the region where to apply this time trigger monitor. This allows to adapt this trigger to the time change according to local (region/country) criteria/rules.
      - `data` DataTrigger — A monitor for triggering the vehicle data change event.
        - `data` 'vehicle.alert' | 'vehicle.odometer' | 'vehicle.powertrain.status' | 'vehicle.engines.thermic.oil.temp' | 'vehicle.energy.electric.level' | 'vehicle.energy.electric.autonomy' | 'vehicle.energy.fuel.level' | 'vehicle.energy.fuel.autonomy' | 'vehicle.autonomy' | 'vehicle.energy.charging.status' | 'vehicle.energy.charging.plugged' | 'vehicle.energy.charging.type' | 'vehicle.doorsState.lockedState' | 'vehicle.doorsState.opening' | 'vehicle.kinetic.moving' | 'vehicle.kinetic.speed' | 'vehicle.trip' | 'vehicle.trip.start' | 'vehicle.trip.stop' | 'vehicle.trip.duration' | 'vehicle.trip.distance' | 'vehicle.trip.state' | 'vehicle.maintenance.daysBeforeMaintenance' | 'vehicle.maintenance.mileageBeforeMaintenance' | 'vehicle.safety.beltWarning' | 'environment.air.temp' | 'privacy.state' | 'vehicle.drivingBehavior.mode' | 'vehicle.collision.side' | 'vehicle.collision.severity' | 'vehicle.safety.autoECallTriggering' | 'vehicle.preconditioning.airConditioning' | 'vehicle.alarm.trigger.type' | 'vehicle.alarm.status.activation' | 'stolen.state', required — The left operand of the trigger function. The following Table details for each operand data its type, the supported operator and the possibly retruned value: |**Data**|**Type**|**Op**|**Value**| |---|---| ---:| ---:| | vehicle.alert | List of value | onChange (at least one)/includedIn/equalsTo | Value (ObjetAlert) | | vehicle.odometer | Number | equalsTo/greaterThan/lowerThan/ | Value | | vehicle.powertrain.status |Enum(powertrain.status) | equalsTo / onChange/includedIn | Value | | vehicle.engines.thermic.oil.temp | Integer | equalsTo/greaterThan/ lowerThan/ | Value | | vehicle.energy.electric.level | Integer | equalsTo/greaterThan/ lowerThan/ | Value | | vehicle.energy.electric.autonomy | Integer | equalsTo/greaterThan/ lowerThan/ | Value | | vehicle.energy.fuel.level | Integer | equalsTo/greaterThan/ lowerThan/ | Value | | vehicle.energy.fuel.autonomy | Integer | equalsTo/greaterThan/ lowerThan/ | Value | | vehicle.autonomy (global) | Integer | equalsTo/greaterThan/ lowerThan/ | Value | | vehicle.energy.charging.status | Enum(ChargingStatusEnum) | onChange/equalsTo/includedIn | Value | | vehicle.energy.charging.plugged | Boolean | onChange/equalsTo | Value | | vehicle.energy.charging.type | Enum(ChargingTypeEnum) | onChange/equalsTo | Value | | vehicle.doorsState.lockedState | N/A | onChange | Value | | vehicle.doorsState.opening | N/A | onChange | Value | | vehicle.kinetic.moving| Boolean | onChange/equalsTo | Value (true/false) | | vehicle.kinetic.speed | Number | equalsTo/greaterThan/ lowerThan/ | Value | | vehicle.trip (DEPRECATED)| Literal | onChange| Value(IDTRIP) | | vehicle.trip.start| Literal | onChange| Value(IDTRIP) | | vehicle.trip.stop| Literal | onChange| Value(IDTRIP) | | vehicle.trip.duration| Integer | equalsTo/greaterThan/lowerThan| Value | | vehicle.trip.distance| Number | equalsTo/greaterThan/lowerThan| Value | | vehicle.trip.state| List of value |includedIn| TripStateEnumArray | | vehicle.maintenance.daysBeforeMaintenance, | Number | equalsTo/ greaterThan/ lowerThan/ | Value | | vehicle.maintenance.mileageBeforeMaintenance| Number | equalsTo/ greaterThan/ lowerThan/ | Value | | vehicle.safety.beltWarning | Enum(beltWarning) | onChange/equalsTo | Value | | environment.air.temp | Number | equalsTo/greaterThan/lowerThan/ | Value | | privacy.state | Enum(Privacy) | equalsTo / onChange/includedIn | Value | | vehicle.drivingBehavior.mode | Enum(drivingBehavior.mode) | equalsTo / onChange/includedIn | Value | | vehicle.collision.side | Enum(collision.side) | equalsTo / includedIn | Value | | vehicle.collision.severity | Enum(collision.severity) | equalsTo / includedIn | Value | | vehicle.safety.autoECallTriggering | Enum(safety.autoECallTriggering) | equalsTo / onChange/includedIn | Value | | vehicle.preconditioning.airConditioning | N/A| onChange | Value | | vehicle.alarm.trigger.type | Enum(trigger.type)| onChange/equalsTo/includedIn | Value | | vehicle.alarm.status.activation | Enum(status.activation)| onChange/equalsTo | Value | | stolen.state |Boolean| onChange/equalsTo| Value | The right operand (value) argument depends on the type of operation (OP) as following: * onChange: no value because we are monitoring the change between two states (before and after). * includedIn: value must be an array of size> = 1 * equalsTo, greaterThan and lowerThan: the value must be an array of size = 1.
        - `op` 'equalsTo' | 'greaterThan' | 'lowerThan' | 'includedIn' | 'onChange', required — The operator of the trigger function.
        - `value` string[] — The right operand of the trigger function. It can be a uniq ```value``` or a list of value ```values```. The choice of one or the other depends on ```OP``` which in the case of ```includedIn``` must be a list. * _Disclaimer_: If the op field is not set to ```includeIn``` then only the first item will be used.
    - `boolExp` string, required — A boolean expression that allow defining a logical relationship between triggers. Used Operands with this expression should be the names of the defined triggers. _Note:_ Always ```true``` or Always```false``` expression are prohibited and will result with an http 400 error response. Grammar: ``` exp ::= exp '&' exp | exp '|' exp | (exp) | !exp ``` * **example**: having two-zone trigger (two towns) named z1 an z2, one time-trigger (8h00 to 20h00) named t1 and finally three data triggerd named as follow: f(fuel), a(autonomy) , o(odometer). we can have a boolean expression such as: : ``` ((z1 & t1) | (z2 & !t1) | (f & z1) | (a & (z1|t)) | (o & (z1 | z2))) ```

## Response `202`

Monitor created or updated successfully

## Other responses

- `default` — unresolved $ref

---

[API](https://skmtc.net/groupe-psa/apis/groupe-psa-connected-car-b2b-api.md) · [All operations](https://skmtc.net/groupe-psa/apis/groupe-psa-connected-car-b2b-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/groupe-psa/groupe-psa-connected-car-b2b-api/revisions/023ff3e3fe51/schema)
