> ## 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 a job execution report

> Returns a **job** execution current **state**. Depending on the **state**, a **report** specifying the **operations** processing details is accessible.

The **job** execution **report** is only accessible during 60 days after its submission.

You can use the *view* parameter to define the level of detail you need :
  - *OVERVIEW* for basic information
  - *DETAILS* for detailed information about the job

**Example 1 : Job execution report -> overview**

```json
{
  "archive": "indexes.tar.gz",
  "state": {
    "current": "DONE",
    "history": [
      {
        "status": "SUBMITTED",
        "ts": "2025-03-13T13:32:47Z"
      },
      //...
    ]
  },
  "report": {
    "overview": {
      "nbOperationsTotal": 1000,
      "nbOperationsOK": 1000,
      "nbOperationsKO": 0
    }
  },
  "_links": {
    // ...
  }
}
```

**Example 2 : Job execution report -> details**
```json
{
    "archive": "indexes.tar.gz",
    "state": {
        "current": "ERROR",
        "history": [
            {
                "status": "SUBMITTED",
                "ts": "2025-03-13T13:32:47Z"
            },
            // ...
        ]
    },
    "report": {
        "overview": {
            "nbOperationsTotal": 2,
            "nbOperationsOK": 1,
            "nbOperationsKO": 1
        },
        "files": [
            {
                "file": "indexes.json",
                "content": {
                    "smartElecIndexesCollectStatus": [
                        {
                            "status": [
                                {
                                    "code": "INCONSISTENT_REQUEST",
                                    "message": "SiteCustomerId, PersonCustomerId and podId are inconsistent for SiteCustomerId = test_site_id_1_FO100"
                                }
                            ],
                            "personCustomerId": "test_client_id_1_FO100",
                            "siteCustomerId": "test_site_id_1_FO100",
                            "podId": "5333333371",
                            "ts": "2024-03-21T23:00:00Z",
                            "generationTs": "2025-01-01T13:43:55Z",
                            "nature": "MKT_CYCLIC_DISTRIBUTOR"
                        },
                        {
                            "status": [
                                {
                                    "code": "OK"
                                }
                            ],
                            "personCustomerId": "test_client_id_1_FO100",
                            "siteCustomerId": "test_site_id_1_FO100",
                            "podId": "pdl58566f9c-f9",
                            "ts": "2024-11-02T00:00:00Z",
                            "generationTs": "2025-01-01T13:43:55Z",
                            "nature": "MKT_CYCLIC_DISTRIBUTOR"
                        }
                    ]
                }
            }
        ]
    },
    "_links": {
        // ...
    }
}
```




## OpenAPI

````yaml /api-reference/indexes-collect-api.yaml get /indexes-collect-jobs/{job-id}
openapi: 3.0.3
info:
  title: Indexes collect lifecycle
  description: |
    This API manages the indexes collection.
  contact:
    email: api@datanumia.com
  version: 0.0.1
servers:
  - url: https://api.home.datanumia.com/api/v2
    description: Production Server
security:
  - Bearer: []
paths:
  /indexes-collect-jobs/{job-id}:
    get:
      summary: Get a job execution report
      description: >
        Returns a **job** execution current **state**. Depending on the
        **state**, a **report** specifying the **operations** processing details
        is accessible.


        The **job** execution **report** is only accessible during 60 days after
        its submission.


        You can use the *view* parameter to define the level of detail you need
        :
          - *OVERVIEW* for basic information
          - *DETAILS* for detailed information about the job

        **Example 1 : Job execution report -> overview**


        ```json

        {
          "archive": "indexes.tar.gz",
          "state": {
            "current": "DONE",
            "history": [
              {
                "status": "SUBMITTED",
                "ts": "2025-03-13T13:32:47Z"
              },
              //...
            ]
          },
          "report": {
            "overview": {
              "nbOperationsTotal": 1000,
              "nbOperationsOK": 1000,
              "nbOperationsKO": 0
            }
          },
          "_links": {
            // ...
          }
        }

        ```


        **Example 2 : Job execution report -> details**

        ```json

        {
            "archive": "indexes.tar.gz",
            "state": {
                "current": "ERROR",
                "history": [
                    {
                        "status": "SUBMITTED",
                        "ts": "2025-03-13T13:32:47Z"
                    },
                    // ...
                ]
            },
            "report": {
                "overview": {
                    "nbOperationsTotal": 2,
                    "nbOperationsOK": 1,
                    "nbOperationsKO": 1
                },
                "files": [
                    {
                        "file": "indexes.json",
                        "content": {
                            "smartElecIndexesCollectStatus": [
                                {
                                    "status": [
                                        {
                                            "code": "INCONSISTENT_REQUEST",
                                            "message": "SiteCustomerId, PersonCustomerId and podId are inconsistent for SiteCustomerId = test_site_id_1_FO100"
                                        }
                                    ],
                                    "personCustomerId": "test_client_id_1_FO100",
                                    "siteCustomerId": "test_site_id_1_FO100",
                                    "podId": "5333333371",
                                    "ts": "2024-03-21T23:00:00Z",
                                    "generationTs": "2025-01-01T13:43:55Z",
                                    "nature": "MKT_CYCLIC_DISTRIBUTOR"
                                },
                                {
                                    "status": [
                                        {
                                            "code": "OK"
                                        }
                                    ],
                                    "personCustomerId": "test_client_id_1_FO100",
                                    "siteCustomerId": "test_site_id_1_FO100",
                                    "podId": "pdl58566f9c-f9",
                                    "ts": "2024-11-02T00:00:00Z",
                                    "generationTs": "2025-01-01T13:43:55Z",
                                    "nature": "MKT_CYCLIC_DISTRIBUTOR"
                                }
                            ]
                        }
                    }
                ]
            },
            "_links": {
                // ...
            }
        }

        ```
      operationId: bulk mode
      parameters:
        - name: view
          in: query
          description: |-
            The level of details requested for the report : 
              - OVERVIEW: job execution state (current & history) and operations status overview 
              - DETAILS: OVERVIEW + detailed status at the operation level
          schema:
            type: string
          example: DETAILS
        - name: job-id
          in: path
          description: Id of the requested job
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Job detail in success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SingleJobReportDTO'
        '400':
          description: |-
            Functional error. Possible values:

            Error code | Error case
            ---------|----------
            ILLEGAL_ARGUMENT | Invalid UUID string

            This list can be expanded over time.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: |-
            Not found. Possible values:

            Error code | Error case
            ---------|----------
            JOB_NOT_FOUND | No job found for the provided id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    SingleJobReportDTO:
      type: object
      properties:
        archive:
          type: string
          description: Name of the archive associated with this job execution.
          example: myOperationsArchive.tar.gz
        state:
          $ref: '#/components/schemas/StateDTO'
        report:
          $ref: '#/components/schemas/ReportDTOContentStatusDTO'
        _links:
          $ref: '#/components/schemas/Link'
    ApiError:
      type: object
      properties:
        errorCode:
          type: string
          description: The error code.
        errorDescription:
          type: string
          description: The error description
      required:
        - errorCode
        - errorDescription
    StateDTO:
      type: object
      properties:
        current:
          type: string
          description: "Current state of the bulk job.\r\nState | Description \r\n---------|----------\r\nSUBMITTED | The archive is received but processing has not started\r\nIN_PROGRESS | The archive is being processed.\r\nDONE | Archive processing is completed without errors and a detailed report on each operation is accessible.\r\nERROR | 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.\r\nINTERNAL_ERROR | Archive processing was interrupted due to a series of internal errors that occurred while processing a JSON file. Datanumia requires intervention to correct these errors.\r\nDELETED | Archive has been deleted (occurs 60 days after processing). Detailed status report is no more available"
          enum:
            - SUBMITTED
            - IN_PROGRESS
            - DONE
            - ERROR
            - INTERNAL_ERROR
            - DELETED
        history:
          type: array
          description: Contain all the state change timestamp for a job
          items:
            $ref: '#/components/schemas/StatusHistoryEntryDto'
    ReportDTOContentStatusDTO:
      type: object
      description: Generic response
      properties:
        error:
          $ref: '#/components/schemas/ArchiveErrorDTO'
        overview:
          $ref: '#/components/schemas/OverviewDTO'
        files:
          type: array
          items:
            $ref: '#/components/schemas/FileDetailsDTOContentStatusDTO'
    Link:
      type: object
      properties:
        href:
          type: string
        hreflang:
          type: string
        title:
          type: string
        type:
          type: string
        deprecation:
          type: string
        profile:
          type: string
        name:
          type: string
        templated:
          type: boolean
    StatusHistoryEntryDto:
      type: object
      properties:
        status:
          type: string
          description: "Historical state of the bulk job.\r\n\r\nState | Description \r\n---------|----------\r\nSUBMITTED | The archive is received but processing has not started\r\nIN_PROGRESS | The archive is being processed.\r\nDONE | Archive processing is completed without errors and a detailed report on each operation is accessible.\r\nERROR | 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.\r\nINTERNAL_ERROR | Archive processing was interrupted due to a series of internal errors that occurred while processing a JSON file. Datanumia requires intervention to correct these errors.\r\nDELETED | Archive has been deleted (occurs 60 days after processing). Detailed status report is no more available"
          enum:
            - SUBMITTED
            - IN_PROGRESS
            - DONE
            - ERROR
            - INTERNAL_ERROR
            - DELETED
          example: IN_PROGRESS
        ts:
          type: string
          format: date-time
          description: >-
            Timestamp of the state change in Home as defined by RFC 3339,
            section 5.6 using the following format: full-date'T'partial-time'Z'
          example: '2017-07-21T17:32:28Z'
    ArchiveErrorDTO:
      type: object
      properties:
        code:
          type: string
          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 5 JSON files\r\nINTERNAL_ERROR | Archive processing was interrupted due to a series of internal errors that occurred while processing a JSON file. Datanumia requires intervention to correct these errors."
          enum:
            - INVALID_ARCHIVE_FORMAT
            - TOO_MANY_FILES
            - INTERNAL_ERROR
          example: INVALID_ARCHIVE_FORMAT
        message:
          type: string
          description: Error message
    OverviewDTO:
      type: object
      properties:
        nbOperationsTotal:
          type: integer
          format: int32
          description: Number of executed operations
          example: 146
        nbOperationsOK:
          type: integer
          format: int32
          description: Number of succeeded operations
          example: 146
        nbOperationsKO:
          type: integer
          format: int32
          description: Number of failed operations
          example: 0
    FileDetailsDTOContentStatusDTO:
      type: object
      properties:
        file:
          type: string
          description: File name in the archive
          example: test.json
        error:
          $ref: '#/components/schemas/FileErrorDTO'
        content:
          $ref: '#/components/schemas/ContentStatusDTO'
    FileErrorDTO:
      type: object
      properties:
        code:
          type: string
          description: "Error code | Error case  \r\n---------|---------- \r\nINVALID_FILE_FORMAT | File must be in JSON format\r\nTOO_MANY_OPERATIONS | Each JSON file can contain up to 10 000 indexes or 1500 load curves\r\nINTERNAL_ERROR | File processing is interrupted to prevent disruption to production systems because 15 INTERNAL_ERROR errors occur within a sliding window of 20 operations. Datanumia intervention is required to resolve this issue."
          enum:
            - INVALID_FILE_FORMAT
            - TOO_MANY_OPERATIONS
            - INTERNAL_ERROR
          example: INVALID_FILE_FORMAT
        message:
          type: string
          description: Error message
    ContentStatusDTO:
      type: object
      properties:
        smartElecIndexesCollectStatus:
          type: array
          items:
            $ref: '#/components/schemas/SmartElecIndexOperationStatusDTO'
        cyclicGasIndexesCollectStatus:
          type: array
          items:
            $ref: '#/components/schemas/CyclicGasIndexOperationStatusDTO'
    SmartElecIndexOperationStatusDTO:
      type: object
      properties:
        status:
          type: array
          items:
            $ref: '#/components/schemas/FileStatusDTO'
        personCustomerId:
          type: string
          description: Customer id of the person
          example: person-customer-id-1234
        siteCustomerId:
          type: string
          description: Customer id of the site
          example: site-customer-id-978
        siteId:
          type: string
          description: Datanumia id for the site
          example: site-home-id-451
        podId:
          type: string
          description: Id of the point of delivery
          example: site-home-id-451
        ts:
          type: string
          description: Datetime of the index
          example: '2021-07-21T00:00:00Z'
        generationTs:
          type: string
          description: Datetime of receipt of the index
          example: '2021-07-21T00:00:00Z'
        nature:
          type: string
          description: Nature of the index
          enum:
            - MKT_SMART_DISTRIBUTOR
            - MKT_SMART_DISTRIBUTOR_INVALID
            - UNKNOWN
      required:
        - generationTs
        - personCustomerId
        - siteCustomerId
        - ts
    CyclicGasIndexOperationStatusDTO:
      type: object
      properties:
        status:
          type: array
          items:
            $ref: '#/components/schemas/FileStatusDTO'
        personCustomerId:
          type: string
          description: Customer id of the person
          example: person-customer-id-1234
        siteCustomerId:
          type: string
          description: Customer id of the site
          example: site-customer-id-978
        siteId:
          type: string
          description: Datanumia id for the site
          example: site-home-id-451
        podId:
          type: string
          description: Id of the point of delivery
          example: site-home-id-451
        ts:
          type: string
          description: Datetime of the index
          example: '2021-07-21T00:00:00Z'
        generationTs:
          type: string
          description: Datetime of receipt of the index
          example: '2021-07-21T00:00:00Z'
        nature:
          type: string
          description: Nature of the index
          enum:
            - MKT_CYCLIC_DISTRIBUTOR
            - MKT_ESTIMATION
            - DTN_CUSTOMER_ACK
            - MKT_CUSTOMER
            - MKT_CYCLIC_DISTRIBUTOR_INVALID
            - MKT_ESTIMATION_INVALID
            - DTN_CUSTOMER_ACK_INVALID
            - MKT_CUSTOMER_INVALID
            - UNKNOWN
      required:
        - generationTs
        - personCustomerId
        - siteCustomerId
        - ts
    FileStatusDTO:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: "The status code can be OK meaning the operation is well processed. Or KO, with an error code and a message specifying the problem encountered.\r\n\r\nError code | Error case  \r\n---------|----------\r\nFIELD_IS_MANDATORY | A required field is missing\r\nFIELD_IS_INVALID | A field content do not match the regex specified in the documentation\r\nINCONSISTENT_REQUEST | The site, pod and person info do not match\r\nNO_TS_IN_THE_FUTURE | The date \"ts\" is in the future\r\nINTERNAL ERROR | Error requires an investigation to restore the service and/or correct the anomaly on Datanumia's side."
          example: FIELD_IS_MANDATORY
        message:
          type: string
          example: podId is mandatory
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````