Maintenance Plans

Update a maintenance plan

Changed on
patch/maintenanceplans/{id}

Request

  • Base URL
    https://api.getmaintainx.com/v1
  • Auth
    HTTP bearer

Path parameters

idinteger required

ID of the maintenance plan

Query parameters

skipWebhookboolean

Set skipWebhook=true, skipWebhook=1 or skipWebhook=yes to skip all webhooks upon successful operation on the endpoint. Learn more about webhooks

Request body

namestring

Name of the maintenance plan.

startDatestring date-time

The first due date for generated work orders.

workOrderBlueprintIdnumber

ID of the maintenance plan work order blueprint used to generate work orders. These can be created through the /maintenanceplans/workorderblueprints endpoint.

workOrderStartDatePaddingnumber

Hours between the start date and due date of generated work orders. Deprecated: use workOrderStartDateOffset instead.

triggerType'CALENDAR' | 'METER' | 'CALENDAR_OR_METER'

What triggers work order generation. Immutable after creation - the plan's current value is accepted, a different value is rejected. To use a different schedule type, create a new plan and archive this one.

intervalStrategy'FIXED' | 'FLOATING'

The interval strategy for the schedule. Immutable after creation - the plan's current value is accepted, a different value is rejected. To use a different schedule behavior, create a new plan and archive this one.

meterIdinteger nullable

Global ID of the meter driving this plan. Null unless triggerType is METER or CALENDAR_OR_METER.

meterTriggerCondition'INCREASED_BY' | 'DECREASED_BY' nullable

Direction the meter must move to trigger work order generation. INCREASED_BY suits meters that climb (odometer, run hours); DECREASED_BY suits meters that fall (fuel level, coolant).

meterIntervalValueinteger nullable

Usage cycle between work orders, in the meter's own unit.

meterHorizonValueinteger nullable

Lead buffer, in meter units, for generating the work order before the next due value is reached.

meterNextDueValueinteger nullable

Meter reading at which the next work order is due.

nextWorkOrderToGenerateDueDatestring date-time nullable

Override the due date of the next work order to be generated.

removedPlanAssetIdsnumber[]

IDs of plan-asset associations to remove.

removedIntervalIdsnumber[]

IDs of intervals to remove.

nextCycleOccurrencenumber nullable

Which cycle in the multi-cycle sequence comes next.

Example request

{
  "name": "Weekly Conveyor Belt Inspection",
  "startDate": "2022-01-01T00:00:00.000Z",
  "workOrderBlueprintId": 10,
  "workOrderStartDatePadding": 48,
  "workOrderStartDateOffset": {
    "value": 2,
    "unit": "DAY"
  },
  "planningHorizon": {
    "value": 3,
    "unit": "WEEK"
  },
  "triggerType": "CALENDAR",
  "intervalStrategy": "FIXED",
  "meterId": 123,
  "meterTriggerCondition": "INCREASED_BY",
  "meterIntervalValue": 5000,
  "meterHorizonValue": 1000,
  "meterNextDueValue": 10000,
  "meterGenerationStartOffset": {
    "value": 2,
    "unit": "DAY"
  },
  "meterGenerationDueOffset": {
    "value": 4,
    "unit": "DAY"
  },
  "nextWorkOrderToGenerateDueDate": "2022-01-01T00:00:00.000Z",
  "addedPlanAssets": [
    {
      "assetId": 100
    }
  ],
  "removedPlanAssetIds": [
    1,
    2
  ],
  "addedUpdatedIntervals": [
    {
      "id": 1,
      "interval": 3,
      "workOrderBlueprintId": 50
    }
  ],
  "removedIntervalIds": [
    1,
    2
  ],
  "nextCycleOccurrence": 2
}

Response

Successfully updated the maintenance plan.

Example response

{
  "maintenancePlan": {
    "id": 1,
    "name": "Weekly Conveyor Belt Inspection",
    "organizationId": 42,
    "startDate": "2022-01-01T00:00:00.000Z",
    "workOrderStartDatePadding": 48,
    "workOrderStartDateOffset": {
      "value": 2,
      "unit": "DAY"
    },
    "workOrderStartDateFixedDay": 5,
    "blueprintEstimatedTime": 60,
    "triggerType": "CALENDAR",
    "intervalStrategy": "FIXED",
    "planningHorizon": {
      "value": 3,
      "unit": "WEEK"
    },
    "meterId": 123,
    "meterTriggerCondition": "INCREASED_BY",
    "meterIntervalValue": 5000,
    "meterHorizonValue": 1000,
    "meterNextDueValue": 10000,
    "meterGenerationStartOffset": {
      "value": 2,
      "unit": "DAY"
    },
    "meterGenerationDueOffset": {
      "value": 4,
      "unit": "DAY"
    },
    "workOrderBlueprintId": 10,
    "assets": [
      {
        "id": 1,
        "assetId": 100
      }
    ],
    "intervals": [
      {
        "id": 1,
        "interval": 3,
        "workOrderBlueprintId": 50
      }
    ],
    "nextCycleOccurrence": 2,
    "nextScheduledWorkOrderDueDate": "2022-01-01T00:00:00.000Z",
    "lastPlannedDueDate": "2022-01-01T00:00:00.000Z",
    "nextWorkOrderGenerationAt": "2022-01-01T00:00:00.000Z",
    "lastWorkOrderGeneratedAt": "2022-01-01T00:00:00.000Z",
    "creatorId": 5,
    "createdAt": "2022-01-01T00:00:00.000Z",
    "updatedAt": "2022-01-01T00:00:00.000Z",
    "archivedAt": "2022-01-01T00:00:00.000Z"
  }
}

Changes

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added subschema #5: Periodically to the request property oneOf list