> ## 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 monthly comparisons

> get the monthly gas energies comparison between the months of the
current year (given as paramter 'year') and the months of the previous
year




## OpenAPI

````yaml /api-reference/comparison.yaml get /sites/{site-id}/monthly-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}/monthly-comparisons:
    get:
      description: |
        get the monthly gas energies comparison between the months of the
        current year (given as paramter 'year') and the months of the previous
        year
      parameters:
        - name: site-id
          in: path
          description: site identifier
          required: true
          schema:
            type: string
        - name: year
          in: query
          description: 'the current year of months comparison (example : 2016)'
          required: true
          schema:
            type: string
        - name: fluid
          in: query
          description: 'possible values :  GAS, ELEC'
          required: true
          schema:
            type: string
      responses:
        '200':
          description: successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MonthlyComparison'
        '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 year is
            mandatory</td></tr>

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

            <tr><td>BAD_YEAR_FORMAT</td><td>The parameter year is not valid. It
            must be an integer</td></tr>

            <tr><td>BAD_FLUID_FORMAT</td><td>The parameter fluid is not valid.
            Valid values are : GAS, ELEC</td>

            </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:
    MonthlyComparison:
      required:
        - month
      type: object
      properties:
        month:
          type: integer
          description: month of the comparison (example 11)
          format: int32
        currentYearMonthConsumption:
          $ref: '#/components/schemas/MonthlyConsumption'
        previousYearMonthConsumption:
          $ref: '#/components/schemas/MonthlyConsumption'
        beginMonthDay:
          type: string
          description: |
            begin month day of the comparison period. ISO-8601 format --MM-DD
            (example --12-01)
        endMonthDay:
          type: string
          description: |
            end month day of the comparison period. ISO-8601 format --MM-DD
            (example --12-15)
        isFullMonth:
          type: boolean
          description: true is if the month is full, false otherwise
        energyDifferenceRate:
          type: integer
          description: |
            % of energy increase or decrease between the month of the previous
            year and the month current year (example 7)
        totalCostDifferenceRate:
          type: integer
          description: |
            % of totalCost increase or decrease between the month of the
            previous year and the month current year (example -5)
    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.)
    MonthlyConsumption:
      required:
        - energy
        - totalCost
      type: object
      properties:
        energy:
          type: integer
          description: energy consumption in standard unit (kWh or SMC) (example 563)
          format: int32
        totalCost:
          type: integer
          description: totalCost of consumption in euros (example 32)
          format: int32

````