spritpreisrechner.at OpenAPI Spec

spritpreisrechner.at is a project from e-control and Austrian government to gather fuel prices all over the country. There is a Swagger 2 specification of the API by e-control to use the data. But the host used in that spec doesn’t exist anymore nor should you use swagger 2 for a project in 2023. I updated the spec to OpenAPI 3 via the online Swagger Editor and configured a working API base url. You can easily do the same but to take a shortcut – here is the resulting file:

openapi: 3.0.1
info:
  title: Spritpreisrechner
  description: Spritpreisrechner Beschreibung
  contact:
    name: E-Control
    url: http://www.e-control.at
    email: office@e-control.at
  version: "2.0"
servers:
- url: //www.spritpreisrechner.at/api
tags:
- name: ping
  description: Ping Rest Controller
- name: regions
  description: Regions Rest Controller
- name: search
  description: Search Rest Controller
paths:
  /ping:
    get:
      tags:
      - ping
      summary: Returns a welcome message and current time of the application
      operationId: pingUsingGET_3
      responses:
        200:
          description: OK
          content:
            text/plain:
              schema:
                type: string
      deprecated: false
  /regions:
    get:
      tags:
      - regions
      summary: Delivers all possible regions that can be used for the region search
      operationId: getRegionsUsingGET
      parameters:
      - name: includeCities
        in: query
        description: Include cities to regions
        allowEmptyValue: false
        schema:
          type: boolean
          default: false
        example: false
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Region'
      deprecated: false
  /regions/units:
    get:
      tags:
      - regions
      summary: Delivers all possible administrative units with coordinates
      operationId: getAdministrativeUnitsUsingGET
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BundeslandDTO'
      deprecated: false
  /search/gas-stations/by-address:
    get:
      tags:
      - search
      summary: Searches for gas stations at the given location
      operationId: searchGasStationsByAddressUsingGET
      parameters:
      - name: fuelType
        in: query
        description: 'Fuel type, allowed values: DIE, SUP, GAS'
        required: true
        allowEmptyValue: false
        schema:
          type: string
          enum:
          - DIE
          - SUP
          - GAS
      - name: includeClosed
        in: query
        description: Include closed gas stations
        allowEmptyValue: false
        schema:
          type: boolean
          default: false
        example: false
      - name: latitude
        in: query
        description: Latitude
        required: true
        allowEmptyValue: false
        schema:
          type: number
          format: double
      - name: longitude
        in: query
        description: Longitude
        required: true
        allowEmptyValue: false
        schema:
          type: number
          format: double
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GasStationPublic'
      deprecated: false
  /search/gas-stations/by-region:
    get:
      tags:
      - search
      summary: Searches for gas stations at the given region
      operationId: searchGasStationsByRegionUsingGET_1
      parameters:
      - name: code
        in: query
        description: Region code
        required: true
        allowEmptyValue: false
        schema:
          type: string
      - name: fuelType
        in: query
        description: 'Fuel type, allowed values: DIE, SUP, GAS'
        required: true
        allowEmptyValue: false
        schema:
          type: string
          enum:
          - DIE
          - SUP
          - GAS
      - name: includeClosed
        in: query
        description: Include closed gas stations
        allowEmptyValue: false
        schema:
          type: boolean
          default: false
        example: false
      - name: type
        in: query
        description: 'Region type, allowed values: BL, PB'
        required: true
        allowEmptyValue: false
        schema:
          type: string
          enum:
          - BL
          - PB
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GasStationPublic'
      deprecated: false
components:
  schemas:
    BezirkDTO:
      title: BezirkDTO
      type: object
      properties:
        c:
          type: integer
          format: int64
        g:
          type: array
          items:
            $ref: '#/components/schemas/GemeindeDTO'
        n:
          type: string
    BundeslandDTO:
      title: BundeslandDTO
      type: object
      properties:
        b:
          type: array
          items:
            $ref: '#/components/schemas/BezirkDTO'
        c:
          type: integer
          format: int64
        n:
          type: string
    Contact:
      title: Contact
      type: object
      properties:
        fax:
          type: string
        mail:
          type: string
        telephone:
          type: string
        website:
          type: string
    GasStationPublic:
      title: GasStationPublic
      required:
      - name
      type: object
      properties:
        contact:
          $ref: '#/components/schemas/Contact'
        distance:
          type: number
          format: double
        id:
          type: integer
          format: int64
        location:
          $ref: '#/components/schemas/Location'
        name:
          type: string
        offerInformation:
          $ref: '#/components/schemas/OfferInformation'
        open:
          type: boolean
        openingHours:
          type: array
          items:
            $ref: '#/components/schemas/OpeningHour'
        otherServiceOffers:
          type: string
        paymentArrangements:
          $ref: '#/components/schemas/PaymentArrangements'
        paymentMethods:
          $ref: '#/components/schemas/PaymentMethods'
        position:
          type: integer
          format: int32
        prices:
          type: array
          items:
            $ref: '#/components/schemas/Price'
    GemeindeDTO:
      title: GemeindeDTO
      type: object
      properties:
        b:
          type: number
        l:
          type: number
        n:
          type: string
        p:
          type: string
    Location:
      title: Location
      type: object
      properties:
        address:
          type: string
        city:
          type: string
        latitude:
          type: number
          format: double
        longitude:
          type: number
          format: double
        postalCode:
          type: string
    OfferInformation:
      title: OfferInformation
      type: object
      properties:
        selfService:
          type: boolean
        service:
          type: boolean
        unattended:
          type: boolean
    OpeningHour:
      title: OpeningHour
      required:
      - day
      type: object
      properties:
        day:
          type: string
          enum:
          - MO
          - DI
          - MI
          - DO
          - FR
          - SA
          - SO
          - FE
        from:
          type: string
        to:
          type: string
    PaymentArrangements:
      title: PaymentArrangements
      type: object
      properties:
        accessMod:
          type: string
        clubCard:
          type: boolean
        clubCardText:
          type: string
        cooperative:
          type: boolean
    PaymentMethods:
      title: PaymentMethods
      type: object
      properties:
        cash:
          type: boolean
        creditCard:
          type: boolean
        debitCard:
          type: boolean
        others:
          type: string
    Price:
      title: Price
      required:
      - fuelType
      type: object
      properties:
        amount:
          type: number
        fuelType:
          type: string
        label:
          type: string
    Region:
      title: Region
      type: object
      properties:
        cities:
          type: array
          items:
            type: string
        code:
          type: integer
          format: int64
        name:
          type: string
        postalCodes:
          type: array
          items:
            type: string
        subRegions:
          type: array
          items:
            $ref: '#/components/schemas/Region'
        type:
          type: string
          enum:
          - PB
          - BL