openapi: 3.0.0
servers:
  - url: https://webtris.highwaysengland.co.uk/api
info:
  contact:
    x-twitter: HighwaysEngland
  title: Highways England API
  version: v1
  x-apisguru-categories:
    - open_data
  x-logo:
    url: https://twitter.com/HighwaysEngland/profile_image?size=original
  x-origin:
    - format: openapi
      url: http://webtris.highwaysengland.co.uk/api/swagger/docs/v1
      version: "3.0"
  x-providerName: highwaysengland.co.uk
paths:
  "/v{version}/areas":
    get:
      deprecated: false
      operationId: Areas_Get
      parameters:
        - in: path
          name: version
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AreaResponse"
          description: ""
        "400":
          description: Bad request
        "500":
          description: Internal Server Error
      summary: Returns list of areas
      tags:
        - Areas
  "/v{version}/areas/{area_Ids}":
    get:
      deprecated: false
      parameters:
        - in: path
          name: area_Ids
          required: true
          schema:
            type: string
        - in: path
          name: version
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AreaResponse"
          description: ""
        "400":
          description: Bad request
        "500":
          description: Internal Server Error
      summary: Returns details of selected area
      tags:
        - Areas
  "/v{version}/quality/daily":
    get:
      deprecated: false
      operationId: Quality_GetDailyDataQualityForSite
      parameters:
        - in: query
          name: siteId
          required: true
          schema:
            type: string
        - description: The start date of the report in the format ddmmyyyy (i.e 31012016)
          in: query
          name: start_date
          required: true
          schema:
            type: string
        - description: The end date of the report in the format ddmmyyyy (i.e 31012016)
          in: query
          name: end_date
          required: true
          schema:
            type: string
        - in: path
          name: version
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DailyQualityResponse"
          description: ""
        "400":
          description: Bad request
        "500":
          description: Internal Server Error
      summary: Get Site DailyQuality
      tags:
        - Quality
  "/v{version}/quality/overall":
    get:
      deprecated: false
      operationId: Quality_GetOverallDataQualityForSites
      parameters:
        - description: Get site quality by site id delimited by ,
          in: query
          name: sites
          required: true
          schema:
            type: string
        - description: The start date of the report in the format ddmmyyyy (i.e 31012016)
          in: query
          name: start_date
          required: true
          schema:
            type: string
        - description: The end date of the report in the format ddmmyyyy (i.e 31012016)
          in: query
          name: end_date
          required: true
          schema:
            type: string
        - in: path
          name: version
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OverallQualityResponse"
          description: ""
        "400":
          description: Bad request
        "500":
          description: Internal Server Error
      summary: Get Site OverallQuality
      tags:
        - Quality
  "/v{version}/reports/{report_type}":
    get:
      deprecated: false
      description: Get's the report.
      operationId: Reports_Index
      parameters:
        - description: Report Type Id (i.e Daily, Monthly, Annual)
          in: path
          name: report_type
          required: true
          schema:
            type: string
        - description: Comma separated list of site Ids.
          in: query
          name: sites
          required: true
          schema:
            type: string
        - description: The start date of the report in the format ddmmyyyy (i.e 31012016)
          in: query
          name: start_date
          required: true
          schema:
            type: string
        - description: The end date of the report in the format ddmmyyyy (i.e 31012016)
          in: query
          name: end_date
          required: true
          schema:
            type: string
        - description: The page offset to return.
          in: query
          name: page
          required: true
          schema:
            format: int32
            type: integer
        - description: The number of rows to return.
          in: query
          name: page_size
          required: true
          schema:
            format: int32
            type: integer
        - in: query
          name: reportSubTypeId
          required: false
          schema:
            format: int32
            type: integer
        - in: path
          name: version
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Object"
          description: ""
        "400":
          description: Bad request
        "500":
          description: Internal Server Error
      summary: Gets the daily report.
      tags:
        - Reports
  "/v{version}/reports/{start_date}/to/{end_date}/{report_type}":
    get:
      deprecated: false
      description: Get's the report.
      parameters:
        - description: Report Type Id (i.e Daily, Monthly, Annual)
          in: path
          name: report_type
          required: true
          schema:
            type: string
        - description: Comma separated list of site Ids.
          in: query
          name: sites
          required: true
          schema:
            type: string
        - description: The start date of the report in the format ddmmyyyy (i.e 31012016)
          in: path
          name: start_date
          required: true
          schema:
            type: string
        - description: The end date of the report in the format ddmmyyyy (i.e 31012016)
          in: path
          name: end_date
          required: true
          schema:
            type: string
        - description: The page offset to return.
          in: query
          name: page
          required: true
          schema:
            format: int32
            type: integer
        - description: The number of rows to return.
          in: query
          name: page_size
          required: true
          schema:
            format: int32
            type: integer
        - in: query
          name: reportSubTypeId
          required: false
          schema:
            format: int32
            type: integer
        - in: path
          name: version
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Object"
          description: ""
        "400":
          description: Bad request
        "500":
          description: Internal Server Error
      summary: Gets the daily report.
      tags:
        - Reports
  "/v{version}/sites":
    get:
      deprecated: false
      operationId: Sites_Index
      parameters:
        - in: path
          name: version
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SiteResponse"
          description: ""
        "400":
          description: Bad request
        "500":
          description: Internal Server Error
      summary: Get a list of sites
      tags:
        - Sites
  "/v{version}/sites/{site_Ids}":
    get:
      deprecated: false
      parameters:
        - description: site id
          in: path
          name: site_Ids
          required: true
          schema:
            type: string
        - in: path
          name: version
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SiteResponse"
          description: ""
        "400":
          description: Bad request
        "500":
          description: Internal Server Error
      summary: Get selected sites
      tags:
        - Sites
  "/v{version}/sitetypes":
    get:
      deprecated: false
      operationId: SiteTypes_Index
      parameters:
        - in: path
          name: version
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SiteTypeResponse"
          description: ""
        "400":
          description: Bad request
        "500":
          description: Internal Server Error
      summary: Return list of site types
      tags:
        - SiteTypes
  "/v{version}/sitetypes/{siteType_Id}/sites":
    get:
      deprecated: false
      operationId: SiteTypes_GetSitesForPublicFacingAPI
      parameters:
        - description: 1 = MIDAS, 2 = TAME, 3 = TMU, 4 = TRADS Legacy
          in: path
          name: siteType_Id
          required: true
          schema:
            format: int32
            type: integer
        - in: path
          name: version
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SiteTypeLayer"
          description: ""
        "400":
          description: Bad request
        "404":
          description: Layer not found
        "500":
          description: Internal Server Error
      summary: Returns the layer metadata for the LayerId specified.
      tags:
        - SiteTypes
components:
  schemas:
    Area:
      properties:
        Description:
          type: string
        Id:
          type: string
        Name:
          type: string
        XLatitude:
          pattern: ^(\+|-)?(?:180(?:(?:\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\.[0-9]{1,15})?))$
          type: string
        XLongitude:
          pattern: ^(\+|-)?(?:90(?:(?:\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\.[0-9]{1,15})?))$
          type: string
        YLatitude:
          pattern: ^(\+|-)?(?:180(?:(?:\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\.[0-9]{1,15})?))$
          type: string
        YLongitude:
          pattern: ^(\+|-)?(?:90(?:(?:\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\.[0-9]{1,15})?))$
          type: string
      required:
        - Name
        - Description
        - XLongitude
        - XLatitude
        - YLongitude
        - YLatitude
      type: object
    AreaResponse:
      properties:
        areas:
          items:
            $ref: "#/components/schemas/Area"
          type: array
        row_count:
          format: int32
          type: integer
      type: object
    DailyQualityResponse:
      properties:
        Qualities:
          items:
            $ref: "#/components/schemas/Qualities"
          type: array
        row_count:
          format: int32
          type: integer
      type: object
    Object:
      properties: {}
      type: object
    OverallQualityResponse:
      properties:
        data_quality:
          format: int32
          type: integer
        end_date:
          type: string
        row_count:
          format: int32
          type: integer
        sites:
          type: string
        start_date:
          type: string
      type: object
    Qualities:
      properties:
        Date:
          format: date-time
          type: string
        Quality:
          format: int32
          type: integer
      type: object
    SiteResponse:
      properties:
        row_count:
          format: int32
          type: integer
        sites:
          items:
            $ref: "#/components/schemas/SiteResult"
          type: array
      type: object
    SiteResult:
      properties:
        Description:
          type: string
        Id:
          type: string
        Latitude:
          format: double
          type: number
        Longitude:
          format: double
          type: number
        Name:
          type: string
        Status:
          type: string
      type: object
    SiteType:
      properties:
        Description:
          type: string
        Id:
          type: string
      type: object
    SiteTypeLayer:
      properties:
        Sites:
          items:
            $ref: "#/components/schemas/Sites"
          type: array
      type: object
    SiteTypeResponse:
      properties:
        row_count:
          format: int32
          type: integer
        sitetypes:
          items:
            $ref: "#/components/schemas/SiteType"
          type: array
      type: object
    Sites:
      properties:
        Active:
          items:
            type: boolean
          type: array
        Description:
          items:
            type: string
          type: array
        Id:
          items:
            type: string
          type: array
        Lattitude:
          items:
            format: double
            type: number
          type: array
        Longitude:
          items:
            format: double
            type: number
          type: array
        SiteId:
          items:
            type: string
          type: array
      type: object
