asyncapi: 2.2.0
info:
  version: 3.1.0
  x-visibility: internal
  title: MindConnect Async API
  description: >
    MindConnect Async API defines topics and message structures to ingest
    timeseries data.


    #### Limitations:

    * There are frequency limits per tenant and per client for published and
    received messages.

    * The number of samplings in a message is limited.

    * The payload for every publish request is limited to 128 KB.
servers:
  EU1:
    url: 'mqtt.ih.eu1.siemens.app:8883'
    description: |
      MQTT Broker for Insights Hub which offers below described topics.
    protocol: mqtt
channels:
  'tc/{tenantId}/{clientId}/o/mc_v3/ts':
    parameters:
      tenantId:
        $ref: '#/components/parameters/TenantId'
      clientId:
        $ref: '#/components/parameters/ClientId'
    publish:
      description: |
        Ingest timeseries data.
      tags:
        - name: Timeseries upload operation
      message:
        summary: Timeseries Message
        $ref: '#/components/messages/TimeseriesMessage'
  'tc/{tenantId}/{clientId}/o/mc_v3/e':
    parameters:
      tenantId:
        $ref: '#/components/parameters/TenantId'
      clientId:
        $ref: '#/components/parameters/ClientId'
    publish:
      description: |
        Ingest event data.
      tags:
        - name: Event upload operation
      message:
        summary: Event Message
        $ref: '#/components/messages/EventMessage'
  'tc/{tenantId}/{clientId}/o/mc_v3/f':
    parameters:
      tenantId:
        $ref: '#/components/parameters/TenantId'
      clientId:
        $ref: '#/components/parameters/ClientId'
    publish:
      description: |
        Ingest file data.
      tags:
        - name: File upload operation
      message:
        summary: File Message
        $ref: '#/components/messages/FileMessage'
components:
  messages:
    TimeseriesMessage:
      name: Timeseries Message
      description: >
        Message contains an array of samplings. Each sampling consist of a
        timestamp and an array of value objects. Each value object consists of
        data point id, value and quality code.
      payload:
        $ref: '#/components/schemas/timeseriesIngestion'
    EventMessage:
      name: Event Message
      description: >
        Message contains an array of events.
      payload:
        $ref: '#/components/schemas/eventIngestion'
    FileMessage:
      name: File Message
      description: >
        Message contains file information to be ingest.
      payload:
        $ref: '#/components/schemas/fileIngestion'
  schemas:
    timeseriesIngestion:
      title: ingestion
      type: object
      properties:
        timeseries:
          type: array
          description: An array of objects each with a timestamp and a list of values.
          minItems: 0
          maxItems: 100
          items:
            type: object
            properties:
              timestamp:
                type: string
                format: date-time
                example: '2020-08-01T00:15:10.100Z'
                description: Date and time in ISO-8601 format.
              values:
                type: array
                minItems: 0
                maxItems: 10000
                description: List of datapoint measurements.
                items:
                  type: object
                  properties:
                    dataPointId:
                      type: string
                      minLength: 1
                      maxLength: 36
                      description: Unique identifier of the data point
                    value:
                      type: string
                      description: Timeseries data value for a given data point id
                      minLength: 1
                      maxLength: 100000
                    qualityCode:
                      type: string
                      minLength: 1
                      maxLength: 36
                      description: Data Quality Code
                  required:
                    - dataPointId
                    - value
                    - qualityCode
            required:
              - timestamp
              - values
      example:
        timeseries:
          - timestamp: '2020-08-01T00:15:10.100Z'
            values:
              - dataPointId: rotationPerMinute
                value: '600'
                qualityCode: '0'
              - dataPointId: temperature
                value: '1.3'
                qualityCode: '-1'
              - dataPointId: gearPosition
                value: '1'
                qualityCode: '0'
              - dataPointId: curve
                value: '381,2776,6586,9362,11268,12139,12247,12574,12846'
                qualityCode: '0'
    eventIngestion:
      title: ingestion
      type: object
      properties:
        events:
          type: array
          description: An array of event objects.
          minItems: 0
          maxItems: 100
          items:
            type: object
            properties:
              id:
                type: string
                example: '7ba7b810-9dad-11d1-80b4-00c04fd430c8'
                description: Unique id of message.
              correlationId:
                type: string
                minLength: 1
                maxLength: 36
                example: 'fd7fb194-cd73-4a54-9e53-97aca7bc8568'
                description: Correlation ID of the event. It can be used to group related events.
              timestamp:
                type: string
                format: date-time
                example: '2020-08-01T00:15:10.100Z'
                description: Date and time in ISO-8601 format.
              severity:
                type: string
                enum:
                  - "20"
                  - "30"
                  - "40"
                example: "20"
                description: Severity of event.
              type:
                type: string
                example: 'FileUploadCompletedEvent'
                minLength: 1
                maxLength: 64
                description: Event type name derived from type AgentBaseEvent.
              description:
                type: string
                example: 'file uploaded event'
                minLength: 1
                maxLength: 255
                description: The description of the event.
              details:
                type: object
                description: Contains fields stated in related event type.
                example: {"fileName": "testFileName" }
            required:
              - id
              - timestamp
              - severity
              - type
              - version
              - details
    fileIngestion:
      title: ingestion
      type: object
      properties:
        file:
          type: object
          description: File object.
          properties:
            name:
              type: string
              minimum: 1
              maximum: 100
              example: 'data_collector'
              description: Name of file.
            type:
              type: string
              minimum: 1
              maximum: 99
              example: 'log'
              description: Extension of file.
            creationDate:
              type: string
              format: date-time
              example: '2020-08-01T00:15:10.100Z'
              description: Date and time in ISO-8601 format.
            content:
              type: string
              example: dGhpcyBpcyBhIGZpbGUgZGF0YQ==
              description: Base64 encoded file content. The content size is limited to 75 KB.
          required:
            - name
            - content
            - creationDate
  parameters:
    ClientId:
      description: >-
        MQTT client id. See the Insights Hub Developer Documentation overview page
        for this API to get more details.
      schema:
        type: string
        example: 201541ad38a4495a96e2021c762b647f_mytenant
    TenantId:
      description: >-
        Id of tenant which client belongs to. See the Insights Hub Developer
        Documentation overview page for this API to get more details.
      schema:
        type: string
        example: mytenant
