Job Status API in Wasabi AiR
    • 20 May 2024
    • 1 Minute to read
    • PDF

    Job Status API in Wasabi AiR

    • PDF

    Article summary

    The Job Status API tracks the running state of harvest and reindex jobs. It is used to establish job status records as well as to both query and update the count of items walked and indexed.

    The job completion percentage is calculated as:
          (job.walked_count / job.indexed_count) * 100
    Therefore, the whole job will be 100% when (walk_complete == true && walked_count == indexed_count).

    Listing Jobs

    GET /api/data/v3/jobstatus?all={all}&page-token={page_token}"
    • all - Include complete jobs (default: false).
    • type - The type of job to search (harvest, reindex, unknown).
    • user - The user ID for specific jobs initiated by a user.
    • page-token - The token specifying results page (for multi-page results).

    Response

    Status 200 (OK)

    {
        "jobs": [
            {
                "request_id": string,
                "container_id": string,
                "user_id": string,
                "walked_count": int,
                "walk_complete": bool,
                "indexed_count": int,
                "error_count": int,
                "created": zulu timestamp,
                "updated": zulu timestamp,
                "cancelled": boolean
            },
            ...
        ],
        "next_page_token": string,
        "previous_page_token": string
    }

    Getting Job Details

    GET /api/data/v3/jobstatus/{request_id}

    Response

    Status 200 (OK)

    {
        "job": {
            "request_id": string,
            "container_id": string,
            "user_id": string,
            "walked_count": int,
            "walk_complete": bool,
            "indexed_count": int,
            "error_count": int,
            "created": zulu timestamp,
            "updated": zulu timestamp,
            "cancelled": boolean
        }
    }

    Errors

    Status 404 (Not Found) - When request_id is not found.

    Cancelling a Harvest Job

    POST /api/data/v3/jobstatus/{request_id}/cancel

    Response

    Status 200 (OK)

    {
        "job": {
            "request_id": string,
            "container_id": string,
            "user_id": string,
            "walked_count": int,
            "indexed_count": int,
            "created": zulu timestamp,
            "updated": zulu timestamp,
            "cancelled": boolean
        }
    }

    Errors

    Status 404 (Not Found) - When request_id is not found.