> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datanumia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get sites yearly gas energies comparisons

> Get the yearly gas energies comparison between a year and the previous
year for a list of years




## OpenAPI

````yaml /api-reference/comparison.yaml get /sites/{site-id}/yearly-gas-energies-comparisons
openapi: 3.0.3
info:
  title: Comparison lifecycle
  version: '1.0'
servers:
  - url: https://api.home.datanumia.com/api/v1
security: []
paths:
  /sites/{site-id}/yearly-gas-energies-comparisons:
    get:
      description: |
        Get the yearly gas energies comparison between a year and the previous
        year for a list of years
      operationId: getYearlyGasEnergiesComparisons
      parameters:
        - name: site-id
          in: path
          description: Site identifier
          required: true
          schema:
            type: string
        - name: years
          in: query
          description: |
            List of years to get the comparisons separated by commas (example
            query : 2013,2014 - the comparison is done between 2014 and 2013 and
            between 2013 and 2012)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/YearlyGasEnergyComparison'
        '400':
          description: >
            Functional error. Possible values:

            <table>

            <tr><td><b>ErrorCode</b></td><td><b>ErrorDescription</b></td></tr>

            <tr><td>PARAM_MANDATORY</td><td>The parameter years is
            mandatory</td></tr>

            <tr><td>INVALID_LIST_PARAMETER</td><td>The list parameter with value
            [incorrect] is invalid or incorrectly formatted.</td></tr>

            </table>
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content: {}
        '404':
          description: Unknown resource
          content: {}
        '500':
          description: Unexpected error
          content: {}
components:
  schemas:
    YearlyGasEnergyComparison:
      required:
        - currentYear
        - energyDifferenceRate
        - previousYear
      type: object
      properties:
        previousYear:
          $ref: '#/components/schemas/YearlyGasEnergyForComparison'
        currentYear:
          $ref: '#/components/schemas/YearlyGasEnergyForComparison'
        energyDifferenceRate:
          type: integer
          description: '% of consumption increase or decreasebetween year N-1 and year N'
          format: int32
    Error:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          type: string
          description: error code - short string (example INVALID_LIST_PARAMETER)
        errorDescription:
          type: string
          description: >-
            complete error description (The list parameter with value
            [incorrect] is invalid or incorrectly formatted.)
    YearlyGasEnergyForComparison:
      required:
        - beginMonth
        - consumption
        - endMonth
        - year
      type: object
      properties:
        year:
          type: string
          description: Year of energy. format YYYY (example 2014)
        beginMonth:
          type: string
          description: begin month of the energy. format YYYY-MM (example 2014-11)
        endMonth:
          type: string
          description: |
            end month of the yearly energy (included). format YYYY-MM (example
            2014-12)
        standingCharge:
          type: integer
          description: standing charges
          format: int32
        totalCost:
          type: integer
          description: sum of the standing charge and the consumption cost
          format: int32
        consumption:
          $ref: '#/components/schemas/YearlyConsumption'
        fromDate:
          type: string
          description: begin date of the comparison (format YYYY-MM-JJ, example 2016-05-01)
        toDate:
          type: string
          description: |
            end date of the comparison (the date is included, format YYYY-MM-JJ,
            example 2016-06-01)
    YearlyConsumption:
      required:
        - energy
      type: object
      properties:
        energy:
          type: integer
          description: Value of the energy in kWh (example 236)
          format: int32
        cost:
          type: integer
          description: Consumption cost in euros (example 32)
          format: int32

````