MaintainX Meter Triggers API

Operations on Meter Triggers

OpenAPI Specification

maintainx-meter-triggers-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  description: Welcome to the MaintainX API documentation!<br/><br/>You can use the MaintainX API to programmatically interact with all the entities in MaintainX. Use it to retrieve and manage data of Work Orders, Work Requests, Assets, and more!<br/><br/>To get started, in your MaintainX account go to <a href="https://app.getmaintainx.com/settings/integrations/apiKeys">"Settings &gt; Integrations"</a> and click "&plus; New Key" button to generate a new Rest API key.<br/><br/><b>Missing something?</b><br/>Don't hesitate to reach out <a href="mailto:support@getmaintainx.com">support@getmaintainx.com</a><br/><br/>
  version: '1'
  title: MaintainX Asset Criticalities Meter Triggers API
  contact:
    url: https://www.getmaintainx.com/
    name: Support
    email: support@getmaintainx.com
  x-logo:
    url: https://maintainx-static.s3-us-west-2.amazonaws.com/img/default-org-logo.png
    backgroundColor: '#FFFFFF'
    altText: MaintainX logo
servers:
- url: https://api.getmaintainx.com/v1
  description: Endpoint
security:
- Bearer: []
tags:
- name: Meter Triggers
  description: Operations on Meter Triggers
  x-traitTag: false
paths:
  /metertriggers:
    post:
      summary: Create meter trigger
      requestBody:
        description: The meter trigger to create
        required: true
        content:
          application/json:
            schema:
              type: object
              description: The meter triger data
              required:
              - meterTrigger
              properties:
                meterTrigger:
                  required:
                  - meterId
                  - amount
                  - condition
                  - name
                  type: object
                  properties:
                    meterId:
                      type: integer
                    workOrderTemplateId:
                      type: integer
                      description: 'Id of an existing work order template. Once this is set, the `workOrderTemplate` object will completely be ignored in favour of the work order template associated with the id. NOTE: If this is set, the name of the meter trigger will match the name of the linked work order template.'
                    amount:
                      type: number
                    condition:
                      type: string
                      enum:
                      - DECREMENTED_BY
                      - INCREMENTED_BY
                      - IS_EQUAL
                      - IS_GREATER
                      - IS_LESS
                      - INCREMENTED_BY_BASED_ON_LAST_READING
                      - DECREMENTED_BY_BASED_ON_LAST_READING
                    dataPoints:
                      type: object
                      required:
                      - numerator
                      - denominator
                      properties:
                        numerator:
                          type: integer
                          description: 'The number of data points out of "denominator" data points to trigger. E.g: 3 points out of 5 must be in a triggering state'
                        denominator:
                          type: integer
                          description: The window of points where the condition gets checked
                    description:
                      type: string
                    minDateForProcessing:
                      type: string
                      format: date-time
                      description: Date that the trigger will start to be active
                    name:
                      type: string
                      description: Name of the trigger
                    nextTriggerValue:
                      type: number
                      description: Can be set to override the first trigger value
                    period:
                      type: integer
                      description: Window in seconds where the data points can be checked
                      nullable: true
                workOrderTemplate:
                  type: object
                  properties:
                    procedureTemplateId:
                      nullable: true
                      type: integer
                      description: ID of the procedure template used
                    saveProcedureAsTemplate:
                      type: boolean
                      nullable: true
                      description: Save the procedure in data as a new procedure template
                    title:
                      deprecated: true
                      type: string
                      description: Title of the work order that will be generated. Use the meter trigger's name instead. If both `workOrderTemplate.title` and `meterTrigger.name` are provided, `meterTrigger.name` will be used.
                    data:
                      type: object
                      properties:
                        assetId:
                          nullable: true
                          type: integer
                        assigneeIds:
                          type: array
                          description: Users IDs assigned to the template
                          items:
                            type: number
                            example: 1
                        description:
                          nullable: true
                          type: string
                          example: A work order sample description
                        dueDate:
                          type: object
                          nullable: true
                          properties:
                            type:
                              type: string
                              enum:
                              - OFFSET
                            offset:
                              type: number
                        locationId:
                          nullable: true
                          type: integer
                          description: Global ID of the location assigned to the work order
                        partsUsed:
                          type: array
                          nullable: true
                          items:
                            type: object
                            properties:
                              partId:
                                type: integer
                                example: 963
                                description: Global ID of the part
                              quantityUsed:
                                type: integer
                                description: Quantity used in the work order.
                                example: 120
                              locationId:
                                type: integer
                                nullable: true
                                description: Global ID of the location of the part
                                example: 852
                              copyOnRecurring:
                                type: string
                                description: Indicates if the parts will be copied to the next work order in the chain (if applicable).
                                default: Default
                                enum:
                                - NoCopy
                                - Copy
                                - Default
                        priority:
                          type: string
                          example: MEDIUM
                          enum:
                          - NONE
                          - LOW
                          - MEDIUM
                          - HIGH
                        procedure:
                          type: object
                          nullable: true
                          required:
                          - title
                          - fields
                          properties:
                            id:
                              type: number
                              example: 1234
                              deprecated: true
                              description: You should favor 'procedureTemplateId' to attach a procedure template.
                            title:
                              type: string
                              description: Title of the procedure
                              example: Control dashboard audit
                            fields:
                              type: array
                              items:
                                type: object
                                required:
                                - type
                                - label
                                properties:
                                  label:
                                    type: string
                                    example: 'Metal Parts: broken, loose, dented, rusty, missing'
                                  type:
                                    type: string
                                    example: INSPECTION_CHECK
                                    enum:
                                    - NUMBER
                                    - AMOUNT
                                    - TEXT
                                    - UNSUPPORTED
                                    - HEADING
                                    - FILE
                                    - SIGNATURE
                                    - MULTIPLE_CHOICE
                                    - INSPECTION_CHECK
                                    - YES_NO_NA
                                    - CHECKBOX
                                    - CHECKLIST
                                    - METER
                                    - DATE
                                    - CYCLE_COUNT
                                  description:
                                    type: string
                                    nullable: true
                                  choices:
                                    type: array
                                    items:
                                      example: Partially
                                      type: string
                                  urls:
                                    type: array
                                    items:
                                      type: object
                                      required:
                                      - link
                                      properties:
                                        label:
                                          type: string
                                          description: Label of the url
                                          example: MaintainX Website
                                        link:
                                          type: string
                                          description: Link
                                          example: www.getmaintainx.com
                                  meterId:
                                    type: number
                                    example: 1
                                    nullable: true
                                    description: Id of the meter
                                  isDateAndTime:
                                    type: boolean
                                    default: false
                                    description: Indicate if a DATE field also contains the time
                                    example: false
                                  index:
                                    type: number
                                    example: 1
                                    description: Order which the row is displayed
                              description: Steps of a procedure
                        tagsIds:
                          type: array
                          description: Categories IDs
                          items:
                            type: number
                            example: 1
                        teamIds:
                          type: array
                          description: Teams IDs
                          items:
                            type: number
                            example: 1
                        title:
                          type: string
                          deprecated: true
                          description: Use the `title` field at the root level. If both `title` and `data.title` are provided, `title` will be used.
                        vendorIds:
                          type: array
                          description: Vendor IDs
                          items:
                            type: number
                            example: 1
      responses:
        '201':
          description: Successfully created the meter trigger
          content:
            application/json:
              schema:
                type: object
                required:
                - id
                properties:
                  id:
                    type: number
                    example: 1
                    description: Id of the meter trigger
        '400':
          description: Failed to create the meter trigger
          content:
            application/json:
              schema:
                type: object
                required:
                - errors
                example:
                  errors:
                  - error: Unexpected error
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      required:
                      - error
                      properties:
                        error:
                          type: string
                        fieldPath:
                          nullable: true
                          type: string
                        fieldValue:
                          nullable: true
                          oneOf:
                          - type: string
                          - type: number
                          - type: boolean
        '401':
          $ref: '#/components/responses/UnauthorizedError'
      tags:
      - Meter Triggers
      parameters:
      - schema:
          type: boolean
        description: Set `skipWebhook=true`, `skipWebhook=1` or `skipWebhook=yes` to skip all webhooks upon successful operation on the endpoint. [Learn more about webhooks](#tag/Subscriptions-and-Webhooks)
        name: skipWebhook
        in: query
        required: false
      - schema:
          type: integer
        description: Required if using a multi organizations token
        name: x-organization-id
        in: header
        required: false
        example: '1'
    get:
      summary: List meter triggers
      description: Endpoint used to list meter trigger resources
      parameters:
      - name: cursor
        in: query
        schema:
          description: Last pagination reference
          type: string
      - name: limit
        in: query
        schema:
          description: max number of Meter Triggers returned
          type: integer
          minimum: 1
          maximum: 200
          default: 100
      - name: meters
        schema:
          type: array
          title: meter ID filters
          description: 'To filter by multiple meter IDs: `meters=630&meters=634`'
          items:
            type: integer
        in: query
      - schema:
          type: integer
        description: Required if using a multi organizations token
        name: x-organization-id
        in: header
        required: false
        example: '1'
      responses:
        '200':
          description: Successfully fetched Meter Triggers list
          content:
            application/json:
              schema:
                type: object
                required:
                - meterTriggers
                properties:
                  meterTriggers:
                    type: array
                    items:
                      type: object
                      required:
                      - id
                      - name
                      - meterId
                      properties:
                        id:
                          type: number
                          example: 963
                          description: Global ID of the trigger.
                        name:
                          type: string
                          example: 'Thermometer #4'
                        meterId:
                          type: number
                          example: 53
                          description: Global ID of the meter.
                  nextCursor:
                    description: The cursor to retrieve the next page of Meter Triggers.
                    type: string
                    nullable: true
                  nextPageUrl:
                    description: Path with query parameters that can be used to retrieve the next page of Meter Triggers.
                    type: string
                    nullable: true
        '400':
          description: Error with query
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                properties:
                  error:
                    description: Description of error
                    type: string
        '401':
          $ref: '#/components/responses/UnauthorizedError'
      tags:
      - Meter Triggers
  /metertriggers/{id}:
    get:
      summary: Get meter trigger
      parameters:
      - schema:
          type: integer
        name: id
        in: path
        required: true
        description: ID of the meterTrigger
        example: '1'
      - in: query
        name: expand
        schema:
          title: Expand specific fields in the request
          type: array
          items:
            type: string
            enum:
            - work_order_template
      responses:
        '200':
          description: Successfully retrieved meterTrigger's information
          content:
            application/json:
              schema:
                type: object
                required:
                - meterTrigger
                properties:
                  meterTrigger:
                    type: object
                    required:
                    - id
                    - meterId
                    - organizationId
                    - amount
                    - condition
                    - createdAt
                    - creatorId
                    - dataPoints
                    - deletedAt
                    - description
                    - minDateForProcessing
                    - name
                    - nextTriggerValue
                    - period
                    - state
                    - updatedAt
                    - workOrderTemplateId
                    properties:
                      id:
                        type: integer
                        description: Global ID of the meter trigger
                      meterId:
                        type: integer
                        description: Global ID of the meter
                      organizationId:
                        type: integer
                        description: Global ID of the organization
                      amount:
                        type: number
                        description: Value used to trigger the condition
                      condition:
                        type: string
                        description: Condition of the trigger
                        enum:
                        - DECREMENTED_BY
                        - INCREMENTED_BY
                        - IS_EQUAL
                        - IS_GREATER
                        - IS_LESS
                        - INCREMENTED_BY_BASED_ON_LAST_READING
                        - DECREMENTED_BY_BASED_ON_LAST_READING
                      createdAt:
                        type: string
                        description: Date at which the meter was created
                        format: date-time
                      creatorId:
                        type: integer
                        description: Global ID of the meter trigger's creator
                      dataPoints:
                        type: object
                        nullable: true
                        properties:
                          numerator:
                            type: integer
                            description: 'The number of data points out of "denominator" data points to trigger. E.g: 3 points out of 5 must be in a triggering state'
                          denominator:
                            type: integer
                            description: The window of points where the condition gets checked
                      deletedAt:
                        type: string
                        nullable: true
                        description: Data at which the meter was delated
                        format: date-time
                      description:
                        type: string
                        nullable: true
                      minDateForProcessing:
                        type: string
                        format: date-time
                        description: Date that the trigger will start to be active
                        nullable: true
                      name:
                        type: string
                        description: Name of the trigger
                      nextTriggerValue:
                        type: number
                        description: Can be set to override the first trigger value
                        nullable: true
                      period:
                        type: integer
                        description: Window in seconds where the data points can be checked
                        nullable: true
                      state:
                        type: string
                        description: State of the trigger
                        enum:
                        - INACTIVE
                        - INSUFFICIENT_DATA
                        - PENDING
                        - STABLE
                        - TRIGGERED
                      updatedAt:
                        type: string
                        description: Date at which the meter was updated
                        format: date-time
                      workOrderTemplateId:
                        type: integer
                        description: Global ID of the work order template used by the meter trigger
                        nullable: true
                      workOrderTemplate:
                        type: object
                        description: Work Order template used by the meter trigger (expand with query parameter)
                        properties:
                          id:
                            type: integer
                            description: Global ID of the work order template
                          createdAt:
                            type: string
                            format: date-time
                            description: Date & time at which the work order template was created
                            example: '2022-01-01T00:00:00.000Z'
                          creatorId:
                            nullable: true
                            type: integer
                            description: ID of the user who created the work order
                          deletedAt:
                            nullable: true
                            type: string
                            format: date-time
                            description: Time at which the template was deleted
                            example: '2022-01-01T00:00:00.000Z'
                          organizationId:
                            nullable: true
                            type: integer
                            description: ID of the organization
                          procedureTemplateId:
                            nullable: true
                            type: integer
                            description: ID of the procedure template used if in the library
                          title:
                            type: string
                            deprecated: true
                            description: Title of the work order that will be generated. Use the meter trigger's name instead
                          updatedAt:
                            nullable: true
                            type: string
                            format: date-time
                            description: Time at which the template was updated
                            example: '2022-01-01T00:00:00.000Z'
                          data:
                            type: object
                            properties:
                              assetId:
                                nullable: true
                                type: integer
                                description: Global ID of the asset assigned to the work order
                              assigneeIds:
                                type: array
                                description: Users IDs assigned to the template
                                items:
                                  type: number
                                  example: 1
                              attachmentIds:
                                nullable: true
                                type: array
                                items:
                                  type: number
                                  example: 1
                                description: IDs of the attachments on the template
                              description:
                                nullable: true
                                type: string
                                example: A work order sample description
                              dueDate:
                                type: object
                                nullable: true
                                properties:
                                  type:
                                    type: string
                                    enum:
                                    - OFFSET
                                  offset:
                                    type: number
                              locationId:
                                nullable: true
                                type: integer
                                description: Global ID of the location assigned to the work order
                              partsUsed:
                                type: array
                                nullable: true
                                items:
                                  type: object
                                  properties:
                                    id:
                                      type: integer
                                      example: 963
                                      description: Global ID of the part
                                    name:
                                      type: string
                                      example: Locknut - 1/8
                                    description:
                                      type: string
                                      nullable: true
                                      example: ''
                                    area:
                                      type: string
                                      example: tool room
                                      nullable: true
                                    unitCost:
                                      type: integer
                                      nullable: true
                                      description: Cost in cents. For example, for $1.20, put 120.
                                      example: 120
                                    availableQuantity:
                                      type: integer
                                      description: Quantity currently in stock
                                      example: 10
                                    minimumQuantity:
                                      type: integer
                                      description: Minimum quantity before you should restock
                                      example: 5
                                    barcode:
                                      type: string
                                      nullable: true
                                      example: bWFpbnRhaW54Cg==
                                      description: String encoded barcode
                                    quantityUsed:
                                      type: integer
                                      description: Quantity used in the work order.
                                      example: 120
                                    copyOnRecurring:
                                      type: string
                                      description: Indicates if the parts will be copied to the next work order in the chain (if applicable).
                                      default: Default
                                      enum:
                                      - NoCopy
                                      - Copy
                                      - Default
                                    locationId:
                                      type: number
                                      description: Global ID of the location of the part
                                      nullable: true
                                      example: 852
                                    extraFields:
                                      type: object
                                      description: Work Order-scoped custom fields for this Part on this specific Work Order. These are distinct from Part-level custom fields (see `partExtraFields`).
                                      additionalProperties:
                                        type: string
                              priority:
                                type: string
                                example: MEDIUM
                                enum:
                                - NONE
                                - LOW
                                - MEDIUM
                                - HIGH
                              procedure:
                                type: object
                                nullable: true
                                required:
                                - title
                                - fields
                                properties:
                                  title:
                                    example: Control dashboard audit
                                    type: string
                                  fields:
                                    type: array
                                    items:
                                      type: object
                                      required:
                                      - id
                                      - label
                                      - type
                                      properties:
                                        id:
                                          type: number
                                          example: 1
                                        label:
                                          type: string
                                          example: 'Metal Parts: broken, loose, dented, rusty, missing'
                                        type:
                                          type: string
                                          example: INSPECTION_CHECK
                                          enum:
                                          - NUMBER
                                          - AMOUNT
                                          - TEXT
                                          - UNSUPPORTED
                                          - HEADING
                                          - FILE
                                          - SIGNATURE
                                          - MULTIPLE_CHOICE
                                          - INSPECTION_CHECK
                                          - 

# --- truncated at 32 KB (267 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/maintainx/refs/heads/main/openapi/maintainx-meter-triggers-api-openapi.yml