---
openapi: 3.1.0
components:
  schemas:
    Instant:
      type: string
      format: date-time
      examples:
      - 2022-03-10T16:15:50Z
    Koala:
      type: object
      properties:
        id:
          type: string
          deprecated: true
          examples:
          - "1001"
          description: Unique id of the koala. Prefer using deviceId instead
        name:
          type: string
          description: User defined name of the koala
        description:
          type: string
          description: User defined description of the koala
        deviceId:
          type: string
          examples:
          - ABCDEFGHIJKL
          description: Unique device id of the koala
        lastCommunication:
          $ref: "#/components/schemas/Instant"
          type: string
          description: Last time the koala communicated
    Value:
      type: object
      properties:
        id:
          type: integer
          deprecated: true
          format: int64
          description: "Deprecated, will be set to null all the time"
        receptionDate:
          $ref: "#/components/schemas/Instant"
          type: string
          description: Reception date of the value (time at which the antenna received
            the packet)
        airTemperatureC:
          type: number
          format: double
          description: Air temperature in Celsius degree
        airHumidityPercent:
          type: number
          format: double
          description: Relative air humidity in percent
        groundTemperatureC:
          type: number
          format: double
          description: Ground temperature in Celsius degree
        wetTemperatureC:
          type: number
          format: double
          description: Wet bulb temperature in Celsius degree
        dewPointC:
          type: number
          format: double
          description: Dew point in Celsius degree
        groundHumidityKpa0:
          type: number
          format: double
          description: Ground "humidity" in KiloPascal (sensor 0)
        groundHumidityKpa1:
          type: number
          format: double
          description: Ground "humidity" in KiloPascal (sensor 1)
        groundHumidityKpa2:
          type: number
          format: double
          description: Ground "humidity" in KiloPascal (sensor 2)
        groundHumidityKpa3:
          type: number
          format: double
          description: Ground "humidity" in KiloPascal (sensor 3)
        windDirectionDegr:
          type: number
          format: double
          description: Wind direction in degree (to north)
        windSpeedKmh:
          type: number
          format: double
          description: Wind speed in km/h
        windGustSpeedKmh:
          type: number
          format: double
          description: Wind burst speed in km/h
        rainMm:
          type: number
          deprecated: true
          format: double
          description: "Rain accumulation in millimeter, use rainMm10m"
        rainMm10m:
          type: number
          format: double
          description: Rain accumulation in millimeter over 10min
        atmosphericPressureHpa:
          type: number
          format: double
          description: Atmospheric Pressure in hecto pascal
        leafWetnessCount:
          type: number
          deprecated: true
          format: double
          description: Leaf wetness count based on the sensor PHYTOS 31 from Meter
            Group
        leafWetnessGrM2:
          type: number
          format: double
          description: Leaf wetness in gr/m2
        solarRadiationWM2:
          type: number
          format: double
          description: Solar radiation in Watt/m2
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
info:
  contact:
    email: info@koalasense.ch
    name: Koalasense support
    url: https://koalasense.ch/contact/
  license:
    name: All rights reserved to Koalasense
  title: Koalasense public API
  version: 1.3.0
security:
- bearer: []
- bearer: []
tags:
- name: Koalas
  description: Retrieve Koalas information
paths:
  /api/public/v1/koala:
    get:
      summary: List koalas
      description: List all the koalas available
      tags:
      - Koalas
      responses:
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Koala"
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - bearer:
        - user
  /api/public/v1/koala/{koalaIdOrDeviceId}/values:
    get:
      summary: Koala values
      description: Get historical values of a koala. Maximum size of the request is
        14 days.
      tags:
      - Koalas
      parameters:
      - description: Koala id or koala device id
        example: ABCD12345
        required: true
        name: koalaIdOrDeviceId
        in: path
        schema:
          type: string
      - description: start of the reception time (inclusive)
        required: true
        name: from
        in: query
        schema:
          type: string
      - description: "Time interval in format ISO8601. Example: 'PT1H' for 1 hour,\
          \ 'PT10M' for 10 minutes."
        required: false
        name: interval
        in: query
        schema:
          type: string
      - description: end of the reception time (exclusive)
        required: false
        name: to
        in: query
        schema:
          type: string
      responses:
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Value"
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - bearer:
        - user
