swagger: "2.0"
schemes:
  - https
host: api.carbondoomsday.com
basePath: /api
info:
  contact:
    x-twitter: CarbonDoomsday
  description: A real-time RESTish web API for worldwide carbon dioxide levels.
  title: CarbonDoomsDay
  version: v1
  x-apisguru-categories:
    - open_data
  x-logo:
    url: https://twitter.com/CarbonDoomsday/profile_image?size=original
  x-origin:
    - format: swagger
      url: https://api.carbondoomsday.com/?format=openapi
      version: "2.0"
  x-providerName: carbondoomsday.com
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  basic:
    type: basic
security:
  - basic: []
paths:
  /co2/:
    get:
      description: |-
        CO2 measurements from the Mauna Loa observatory.

        This data is made available through the good work of the people at the
        Mauna Loa observatory. Their release notes say:

            These data are made freely available to the public and the scientific
            community in the belief that their wide dissemination will lead to greater
            understanding and new scientific insights.

        We currently scrape the following sources:

          * [co2_mlo_weekly.csv]
          * [co2_mlo_surface-insitu_1_ccgg_DailyData.txt]
          * [weekly_mlo.csv]

        We have daily CO2 measurements as far back as 1958.

        Learn about using pagination via [the 3rd party documentation].

        [co2_mlo_weekly.csv]: https://www.esrl.noaa.gov/gmd/webdata/ccgg/trends/co2_mlo_weekly.csv
        [co2_mlo_surface-insitu_1_ccgg_DailyData.txt]: ftp://aftp.cmdl.noaa.gov/data/trace_gases/co2/in-situ/surface/mlo/co2_mlo_surface-insitu_1_ccgg_DailyData.txt
        [weekly_mlo.csv]: http://scrippsco2.ucsd.edu/sites/default/files/data/in_situ_co2/weekly_mlo.csv
        [the 3rd party documentation]: http://www.django-rest-framework.org/api-guide/pagination/#pagenumberpagination
      operationId: co2_list
      parameters:
        - description: ""
          in: query
          name: ppm
          required: false
          type: number
        - description: ""
          in: query
          name: date
          required: false
          type: string
        - description: Multiple values may be separated by commas.
          in: query
          name: date__range
          required: false
          type: string
        - description: Which field to use when ordering the results.
          in: query
          name: ordering
          required: false
          type: string
        - description: A page number within the paginated result set.
          in: query
          name: page
          required: false
          type: integer
        - description: Number of results to return per page.
          in: query
          name: limit
          required: false
          type: integer
      produces:
        - application/json
        - text/csv
      responses:
        "200":
          description: ""
          schema:
            properties:
              count:
                type: integer
              next:
                format: uri
                type: string
              previous:
                format: uri
                type: string
              results:
                items:
                  $ref: "#/definitions/CO2"
                type: array
            required:
              - count
              - results
            type: object
      tags:
        - co2
    parameters: []
  "/co2/{date}/":
    get:
      description: |-
        CO2 measurements from the Mauna Loa observatory.

        This data is made available through the good work of the people at the
        Mauna Loa observatory. Their release notes say:

            These data are made freely available to the public and the scientific
            community in the belief that their wide dissemination will lead to greater
            understanding and new scientific insights.

        We currently scrape the following sources:

          * [co2_mlo_weekly.csv]
          * [co2_mlo_surface-insitu_1_ccgg_DailyData.txt]
          * [weekly_mlo.csv]

        We have daily CO2 measurements as far back as 1958.

        Learn about using pagination via [the 3rd party documentation].

        [co2_mlo_weekly.csv]: https://www.esrl.noaa.gov/gmd/webdata/ccgg/trends/co2_mlo_weekly.csv
        [co2_mlo_surface-insitu_1_ccgg_DailyData.txt]: ftp://aftp.cmdl.noaa.gov/data/trace_gases/co2/in-situ/surface/mlo/co2_mlo_surface-insitu_1_ccgg_DailyData.txt
        [weekly_mlo.csv]: http://scrippsco2.ucsd.edu/sites/default/files/data/in_situ_co2/weekly_mlo.csv
        [the 3rd party documentation]: http://www.django-rest-framework.org/api-guide/pagination/#pagenumberpagination
      operationId: co2_read
      parameters: []
      produces:
        - application/json
        - text/csv
      responses:
        "200":
          description: ""
          schema:
            $ref: "#/definitions/CO2"
      tags:
        - co2
    parameters:
      - format: date
        in: path
        name: date
        required: true
        type: string
definitions:
  CO2:
    properties:
      date:
        format: date
        title: Date
        type: string
      ppm:
        format: decimal
        title: Ppm
        type: string
    required:
      - ppm
      - date
    type: object
