> ## 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.

# Retrieve the comparison of annual electric energies in kWh between one
year and the previous year, for a list of years, by tariff item (graph
of comparison of annual energies.


> Returning service for each year compared: the months between which the comparison was made, the electric energies by rate line of the site in Wh over the years requested, the percentage of evolution between the two years.




## OpenAPI

````yaml /api-reference/comparison.yaml get /sites/{site-id}/yearly-elec-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-elec-energies-comparisons:
    get:
      tags:
        - Yearly Elec Comparison
      summary: |
        Retrieve the comparison of annual electric energies in kWh between one
        year and the previous year, for a list of years, by tariff item (graph
        of comparison of annual energies.
      description: >
        Returning service for each year compared: the months between which the
        comparison was made, the electric energies by rate line of the site in
        Wh over the years requested, the percentage of evolution between the two
        years.
      operationId: getYearlyElenecEnergiesComparisonsGET
      parameters:
        - name: site-id
          in: path
          description: Edelia ID of the site
          required: true
          schema:
            type: string
        - name: years
          in: query
          description: |
            Array of years for which a comparison of consumption between the
            year requested and the previous one. Format yyyy separated by ,
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BcElecYearlyComparison'
        '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/ErrorResponse'
        '404':
          description: Site not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Technical Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    BcElecYearlyComparison:
      required:
        - currentYear
        - energyDifferenceRate
        - previousYear
      type: object
      properties:
        currentYear:
          $ref: '#/components/schemas/BcElecYear'
        previousYear:
          $ref: '#/components/schemas/BcElecYear'
        energyDifferenceRate:
          type: integer
          description: >
            Pourcentage d'augmentation de l'énergie consommée entre l'année N-1
            et N
          format: int32
        costDifferenceRate:
          type: integer
          description: Cost difference between year N and year N-1. Expressed in percentage
          format: int32
        weatherImpactMessageCode:
          type: string
          description: Code of the weather impact message to display
          example: COLDER_WEATHER_HIGHER_CONSO
        weatherImpactParameters:
          type: object
          description: >-
            Only when weatherImpactMessageCode is returned. Map of keys and
            values matching the variables to replace in the text of the message
            with messageCode (example "impactPercent":23,"typeOfWinter":"hiver
            rigoureux").
    ErrorResponse:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          type: string
          description: The error code
        errorDescription:
          type: string
          description: The error description
      description: ErrorResponse
    BcElecYear:
      type: object
      properties:
        year:
          type: string
        beginMonth:
          type: string
        endMonth:
          type: string
        fromDate:
          type: string
        toDate:
          type: string
        consumption:
          $ref: '#/components/schemas/BcElecConsumption'
    BcElecConsumption:
      type: object
      properties:
        energy:
          type: number
        cost:
          type: number
        energiesByTariffHeading:
          type: object
        costsByTariffHeading:
          type: object

````