Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Beskrivning

Tjänsten listar mätdata beroende på vilken kategori som anges.

Livscykelstatus

Design

Lösningsbeskrivning

<Infoga en Gliffy-bild som visuellt beskriver lösningen>

Hantering av personuppgifter

<Vilka personuppgifter hanteras och varför?>

API specifikation

Draft 1:

Swagger ui
---
openapi: 3.0.2
info:
  title: MeasurementData API
  description: "API for fetching measurement-data"
  version: 1.0.0
tags:
  - name: MeasurementData API endpoints
paths:
  /measurmentdata:
    get:
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetMeasurementDataRequest'
        required: true      
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ElectricityData'
                  - $ref: '#/components/schemas/BroadbandData'
                  - $ref: '#/components/schemas/ElectricityData'
                  - $ref: '#/components/schemas/DistrictHeatingData'
                  - $ref: '#/components/schemas/WasteManagementData'
                discriminator:
                  propertyName: objectType
                  mapping:
                    electricityData: '#/components/schemas/ElectricityData'
                    broadbandData: '#/components/schemas/BroadbandData'
                    districtHeatingData: '#/components/schemas/DistrictHeatingData'
                    wasteManagementgData: '#/components/schemas/WasteManagementData'
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
components:
  schemas:
    GetMeasurementDataRequest:
      type: object
      properties:
        personId:
          type: string
          description: Person ID
          example: '81471222-5798-11e9-ae24-57fa13b361e1'
        category:
          type: string
          description: Category
          example: 'ELECTRICITY'
        facilityId:
          type: string
          description: Facility ID
          example: '112233'
        fromDate:
          type: string
          format: date
          description: From-date
          example: '2022-01-01'
        toDate:
          type: string
          format: date
          description: To-date
          example: '2022-03-01'
        resolution:
          $ref: '#/components/schemas/Resolution'
    BroadbandData:
      type: object
      description: Broadband data measurments
      required:
        - objectType
        - installationId
        - resolution
      properties:
        objectType:
          type: string
          example: 'broadbandData'
        installationId:
          type: string
          example: '1112233'
        resolution:
          $ref: '#/components/schemas/Resolution'
        measurements:
          type: array
          description: Measurement
          items:
            type: object
            properties:
              resolutionPeriod:
                type: string
                format: date-time
                example: '2022-01-02 23:59:00'
              value:
                type: number
                format: float
                example: '22.43'
              unit:
                type: string
                example: 'GB'
    ElectricityData:
      type: object
      description: Electricity measurments
      required:
        - objectType
        - installationId
        - resolution
      properties:
        objectType:
          type: string
          example: 'electricityData'
        installationId:
          type: string
          example: '1112233'
        resolution:
          $ref: '#/components/schemas/Resolution'
        measurements:
          type: array
          description: Measurement
          items:
            type: object
            properties:
              resolutionPeriod:
                type: string
                format: date-time
                example: '2022-01-01 00:00:00'
              readingType:
                type: string
                example: 'Aktiv'
              value:
                type: number
                format: float
                example: '6.10000'
              unit:
                type: string
                example: 'kWh'
    WasteManagementData:
      type: object
      description: WasteManagement measurments
      required:
        - objectType
        - installationId
        - resolution
      properties:
        objectType:
          type: string
          example: 'wasteManagementData'
        installationId:
           type: string
           example: '1112233'
        resolution:
          $ref: '#/components/schemas/Resolution'
        measurements:
          type: array
          description: Measurement
          items:
            type: object
            properties:
              resolutionPeriod:
                type: string
                format: date-time
                example: '2022-01-02 23:59:00'
              value:
                type: number
                format: float
                example: '6.10000'
              unit:
                type: string
                example: 'ton'            
              productId:
                type: string
                example: '1063-1380-0-0-0'
              location:
                type: string
                example: 'Blåberget'
              externalId:
                type: string
                example: '1302069'
              reference:
                type: string
                example: 'ABC123'                    
    DistrictHeatingData:
      type: object
      description: DistrictHeating measurments
      required:
        - objectType
        - installationId
        - resolution
      properties:
        objectType:
          type: string
          example: 'districtHeatingData'
        installationId:
          type: string
          example: '1112233'
        resolution:
          $ref: '#/components/schemas/Resolution'
        measurements:
          type: array
          description: Measurement
          items:
            type: object
            properties:
              resolutionPeriod:
                type: string
                format: date-time
                example: '2022-01-01 00:00:00'
              energy:
                type: number
                format: float
                example: '4.160000'
              energyUnit:
                type: string
                example: 'MWh'                      
              volume:
                type: number
                format: float
                example: '96.10000'
              volumeUnit:
                type: string
                example: 'm3'
              flowTemprature:
                type: number
                format: float
                example: '76.5'
              returnTemprature:
                type: string
                example: '57.2'                      
    ServiceErrorResponse:
      type: object
      properties:
        httpCode:
          format: int32
          type: integer
        message:
          type: string
        technicalDetails:
          $ref: '#/components/schemas/TechnicalDetails'
    TechnicalDetails:
      type: object
      properties:
        rootCode:
          format: int32
          type: integer
        rootCause:
          type: string
        serviceId:
          type: string
        requestId:
          type: string
        details:
          type: array
          items:
            type: string
    Resolution:
      type: string
      enum:
        - Hour
        - Day
        - Month
        - Year

Draft 2:

Swagger ui
openapi: 3.0.2
info:
  title: MeasurementData API
  description: "API for fetching measurement-data"
  version: 1.0.0
tags:
  - name: MeasurementData API endpoints
paths:
  /measurmentdata:
    get:
      parameters:
        - in: query
          name: personId
          schema:
            type: string
          description: Person ID
          example: '81471222-5798-11e9-ae24-57fa13b361e1'
          required: true
        - in: query
          name: category
          schema:
            $ref: '#/components/schemas/Category'
          description: Category of data
          example: 'ELECTRICITY'
          required: true
        - in: query
          name: facilityId
          schema:
            type: string
          description: Facility ID
          example: '112233'
          required: true
        - in: query
          name: fromDate
          schema:
            type: string
            format: date
          description: From date
          example: '2022-01-31'
          required: true
        - in: query
          name: toDate
          schema:
            type: string
            format: date
          description: To date
          example: '2022-03-31'
          required: true
        - in: query
          name: resolution
          schema:
            $ref: '#/components/schemas/Resolution'
          required: true
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Data'
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
components:
  schemas:
    Data:
      type: object
      required:
        - category
        - installationId
        - aggregationUnit
      properties:
        category:
          $ref: '#/components/schemas/Category'
        installationId:
          type: string
          example: '1112233'
        resolution:
          $ref: '#/components/schemas/Resolution'
        measurementSeries:
          type: array
          description: Measurement series from different measurement points
          items:
            type: object
            properties:
              unit:
                type: string
                description: Unit for all measurement points
                example: 'm3'
              measurementType:
                type: string
                description: Type of measurement
                example: 'volume'
              metaData:
                type: array
                description: Meta data for a serie
                items:
                  type: object
                  properties:
                    key:
                      type: string
                      example: 'refid'
                    value:
                      type: string
                      example: '123'
              measurementPoints:
                type: array
                description: DataPoint
                items:
                  type: object
                  properties:
                    value:
                      type: number
                      format: float
                      example: '22.312'
                    date:
                      type: string
                      format: date-time
    ServiceErrorResponse:
      type: object
      properties:
        httpCode:
          format: int32
          type: integer
        message:
          type: string
        technicalDetails:
          $ref: '#/components/schemas/TechnicalDetails'
    TechnicalDetails:
      type: object
      properties:
        rootCode:
          format: int32
          type: integer
        rootCause:
          type: string
        serviceId:
          type: string
        requestId:
          type: string
        details:
          type: array
          items:
            type: string
    Category:
      type: string
      enum:
        - DISTRICT_HEATING
        - ELECTRICITY
        - BROADBAND
        - WASTE
    Resolution:
      type: string
      enum:
        - Hour
        - Day
        - Month
        - Year

Säkerhetsklassning

Säkerhetsklass <0, 1, 2, 3, 4>

Autentiseringsmetod: <API Key, Oauth2>

(Ref: Säkerhetsklassning av APIer )

API-ägare

<Kontaktuppgifter till den verksamhet som äger APIets livscykel>

Teknisk ägare

<Kontaktuppgifter till utvecklare/teknisk förvaltare>

Länkar

<Länkar till dev-portal;

  • Test

  • Sandbox

  • Produktion>

FAQ

<FAQ>