> ## 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 the execution status of all contracts jobs

> Returns a list of **jobs** between two dates, with their **state** and an overview of the OK/KO operations
Results are paginated.

**State** | Description
---------|----------
**SUBMITTED**  | The archive is received but processing has not started. 
**IN_PROGRESS**  | The archive is being processed. 
**DONE**  | Archive processing is completed without errors. 
**ERROR**  | Archive processing is completed but has encountered at least one functional or internal error. The details are available in the detailed report. Actions on the customer's side are necessary to correct them and resend the corresponding contracts.
**INTERNAL_ERROR**  |  Archive processing was interrupted due to a series of internal errors that occurred while processing a JSON file. Actions are required on Datanumia's side to correct these errors.
**DELETED** | Archive has been deleted (occurs 21 days after processing). Detailed status report is no more available.



## OpenAPI

````yaml /api-reference/contracts.yaml get /contracts-jobs
openapi: 3.0.3
info:
  title: Contracts lifecycle
  description: >
    This API manages the lifecycle of contracts associated to a PoD.


    Contract key concepts:

    - A contract is applicable starting it ts value and ends with the next
    contract beginning

    - The definition of an existing contract can be updated using the ts and
    generationTs fields
  termsOfService: TODO
  contact:
    email: api@datanumia.com
  version: 2.0.0
servers:
  - url: https://api.home.datanumia.com/api/v2
    description: Production Server
security: []
paths:
  /contracts-jobs:
    get:
      tags:
        - bulk mode contracts
      summary: Get the execution status of all contracts jobs
      description: >-
        Returns a list of **jobs** between two dates, with their **state** and
        an overview of the OK/KO operations

        Results are paginated.


        **State** | Description

        ---------|----------

        **SUBMITTED**  | The archive is received but processing has not
        started. 

        **IN_PROGRESS**  | The archive is being processed. 

        **DONE**  | Archive processing is completed without errors. 

        **ERROR**  | Archive processing is completed but has encountered at
        least one functional or internal error. The details are available in the
        detailed report. Actions on the customer's side are necessary to correct
        them and resend the corresponding contracts.

        **INTERNAL_ERROR**  |  Archive processing was interrupted due to a
        series of internal errors that occurred while processing a JSON file.
        Actions are required on Datanumia's side to correct these errors.

        **DELETED** | Archive has been deleted (occurs 21 days after
        processing). Detailed status report is no more available.
      operationId: getContractsCustomerJobs
      parameters:
        - name: page
          in: query
          description: Page to be fetched.
          example: '0'
          schema:
            type: string
            default: '0'
        - name: size
          in: query
          description: Page size to be fetched.
          schema:
            type: integer
            default: 100
            maximum: 100
        - name: state
          in: query
          description: State of the jobs be fetched
          schema:
            type: array
            enum:
              - ERROR
              - DONE
              - IN_PROGRESS
              - SUBMITTED
              - INTERNAL_ERROR
              - DELETED
          explode: false
        - name: beginTs
          in: query
          description: >
            Start timestamp for the requested range of jobs. Jobs objects having
            their state updated within the range are returned.


            The supported format is as defined by RFC 3339, section 5.6
            restricted to : full-date'T'partial-time'Z'


            Period between beginTs and endTs is at most 30 days.
          schema:
            type: string
            format: date-time
            default: Current date - 7 days
          example: '2021-07-21T17:32:28Z'
        - name: endTs
          in: query
          description: >
            End timestamp for the requested range of jobs. Jobs objects having
            their state updated within the range are returned.


            The supported format is as defined by RFC 3339, section 5.6
            restricted to : full-date'T'partial-time'Z'


            Period between beginTs and endTs is at most 30 days.
          schema:
            type: string
            format: date-time
            default: Current date
          example: '2021-08-21T17:32:28Z'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractJobsList'
        '400':
          description: "Functional error. Possible values:\r\n\r\nERROR CODE | ERROR CASE\r\n-----------|-----------\r\nINVALID_TS | BeginTs or EndTs is invalid, it must be in the following format: full-date'T'partial-time'Z'\r\nINVALID_TS | BeginTs cannot be after endTs\r\nILLEGAL_ARGUMENT | Period between beginTs and endTs is at most 31 days.\r\n\r\nThis list can be expanded over time."
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
        '500':
          description: Server error
          content: {}
      security:
        - Bearer:
            - home:elec-contracts:jobs:read home:gas-contracts:jobs:read
components:
  schemas:
    ContractJobsList:
      required:
        - page
        - _links
        - _embedded
      type: object
      properties:
        _links:
          $ref: '#/components/schemas/ContractJobsListLinks'
        page:
          $ref: '#/components/schemas/ContractPage'
        _embedded:
          $ref: '#/components/schemas/ContractJobsListEmbedded'
    ErrorResponse:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          description: The error code.
          type: string
        errorDescription:
          type: string
          description: The error description
      description: ErrorResponse
    ContractJobsListLinks:
      type: object
      required:
        - self
      properties:
        first:
          $ref: '#/components/schemas/ContractJobsListLinkFirst'
        prev:
          $ref: '#/components/schemas/ContractJobsListLinkPrev'
        self:
          $ref: '#/components/schemas/ContractJobsListLinkSelf'
        next:
          $ref: '#/components/schemas/ContractJobsListLinkNext'
        last:
          $ref: '#/components/schemas/ContractJobsListLinkLast'
    ContractPage:
      type: object
      required:
        - totalElements
        - totalPages
        - number
        - size
      properties:
        totalElements:
          type: integer
          description: Number of items in the result
          example: 122
        totalPages:
          type: integer
          description: Number of pages in the result
          example: 2
        number:
          type: integer
          description: Current page returned
          example: 1
        size:
          type: integer
          description: Number of items per page
          example: 100
    ContractJobsListEmbedded:
      required:
        - jobs
      type: object
      properties:
        jobs:
          type: array
          items:
            $ref: '#/components/schemas/ContractJobEmbeddedResponse'
    ContractJobsListLinkFirst:
      required:
        - href
      type: object
      properties:
        href:
          type: string
          example: >-
            https://<DATANUMIA_ROOT_URL>/contracts-jobs?page=0&beginTs=2021-07-21T00:00:00Z&endTs=2021-07-28T00:00:00Z
    ContractJobsListLinkPrev:
      required:
        - href
      type: object
      properties:
        href:
          type: string
          example: >-
            https://<DATANUMIA_ROOT_URL>/contracts-jobs?page=0&beginTs=2021-07-21T00:00:00Z&endTs=2021-07-28T00:00:00Z
    ContractJobsListLinkSelf:
      required:
        - href
      type: object
      properties:
        href:
          type: string
          example: >-
            https://<DATANUMIA_ROOT_URL>/contracts-jobs?page=1&beginTs=2021-07-21T00:00:00Z&endTs=2021-07-28T00:00:00Z
    ContractJobsListLinkNext:
      required:
        - href
      type: object
      properties:
        href:
          type: string
          example: >-
            https://<DATANUMIA_ROOT_URL>/contracts-jobs?page=1&beginTs=2021-07-21T00:00:00Z&endTs=2021-07-28T00:00:00Z
    ContractJobsListLinkLast:
      required:
        - href
      type: object
      properties:
        href:
          type: string
          example: >-
            https://<DATANUMIA_ROOT_URL>/contracts-jobs?page=1&beginTs=2021-07-21T00:00:00Z&endTs=2021-07-28T00:00:00Z
    ContractJobEmbeddedResponse:
      required:
        - archive
        - state
      type: object
      properties:
        archive:
          type: string
          description: |
            Name of the archive associated with this job execution.
          example: myOperationsArchive.tar.gz
        state:
          $ref: '#/components/schemas/ContractJobEmbeddedResponseState'
        report:
          $ref: '#/components/schemas/ContractJobEmbeddedReport'
        _links:
          $ref: '#/components/schemas/JobContractLinks'
    ContractJobEmbeddedResponseState:
      type: object
      required:
        - current
        - ts
      properties:
        current:
          type: string
          description: >-
            Current state of the bulk job 


            State | Description 

            ---------|----------

            SUBMITTED | The archive is received but processing has not started

            IN_PROGRESS | The archive is being processed.

            DONE | Archive processing is completed without errors and a detailed
            report on each operation is accessible.

            ERROR | Archive processing is completed but has encountered at least
            one functional or internal error. The details are available in the
            detailed report. Actions on the customer's side are necessary to
            correct them and resend the corresponding contracts.

            INTERNAL_ERROR | Archive processing was interrupted due to a series
            of internal errors that occurred while processing a JSON file.
            Actions are required on Datanumia's side to correct these errors.

            DELETED | Archive has been deleted. Detailed status report is no
            more available
          enum:
            - ERROR
            - DONE
            - IN_PROGRESS
            - SUBMITTED
            - INTERNAL_ERROR
            - DELETED
          example: DONE
        ts:
          type: string
          description: >
            Timestamp of the state change as defined by RFC 3339, section 5.6
            using the following format: full-date'T'partial-time'Z'
          format: date-time
          example: '2017-07-21T17:32:28Z'
    ContractJobEmbeddedReport:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ContractErrorDescriptionJob'
        overview:
          $ref: '#/components/schemas/ContractExecutionReportOverview'
    JobContractLinks:
      required:
        - self
      type: object
      properties:
        self:
          $ref: '#/components/schemas/JobContractLinkSelf'
    ContractErrorDescriptionJob:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          enum:
            - INVALID_ARCHIVE_FORMAT
            - TOO_MANY_FILES
            - INTERNAL_ERROR
          description: "Error code | Error case\r\n---------|----------\r\nINVALID_ARCHIVE_FORMAT | Archive format must be .tar.gz\r\nTOO_MANY_FILES | The archive must contain between 1 and 10 JSON files\r\nINTERNAL_ERROR | Archive processing was interrupted due to a series of internal errors that occurred while processing a JSON file. Actions are required on Datanumia's side to correct these errors."
        message:
          type: string
          description: Error message
    ContractExecutionReportOverview:
      type: object
      properties:
        nbOperationsTotal:
          type: integer
          description: |
            Number of executed contract operations
          example: 146
        nbOperationsOK:
          type: integer
          description: |
            Number of succeed operations
          example: 146
        nbOperationsKO:
          type: integer
          description: |
            Number of failed operations
          example: 0
    JobContractLinkSelf:
      required:
        - href
      type: object
      properties:
        href:
          type: string
          example: https://<DATANUMIA_ROOT_URL>/contracts-jobs/{job-id}
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````