Skip to content

API Jobs

An api job stores logs, statuses, and updates related to any bulk API request. As all bulk update/create requests operate asynchronously, you can ping this service to inquire about the status of the bulk request.

Get API Job

This API endpoint enables you to fetch a api job using its unique identifier, provided when bulk request is accepted.

TIP

It is recommended to not ping this route frequently, only checking every 5-10 minutes should be sufficient.

INFO

  • The total_records will show the exact numbers of items accepted and effected_records will show the number of records actually effected by the requested. Sometimes if the records is already upto date it will not be effected.
  • The message will contain any error/information message produced during the job.
  • The status will show the current status of the job, it can be one any of the following:
    • pending
    • processing
    • completed
    • failed

Once the end_time is not null or status is either completed/failed you can stop pinging

Input


Endpoint

Get /api-jobs/{apiJobID}


HTTP request headers

Content-Type  string

Setting to application/json is required.

Authorization  string

This is the token you fetched e.g. Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS…


Path parameters

apiJobID  string - Required

The unique api job ID you wish to retrieve.

Output


Http status codes
Status CodeDescription
200OK
400Bad Request
404Resource not found
500Internal Server Error

Request example

bash
curl  -X GET \
  'https://client.willsuite.co.uk/engine/api/api-jobs/43dbbc35-d114-4da5-a1c0-6abbea6d7bf5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...'
php
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://client.willsuite.co.uk/engine/api/api-jobs/43dbbc35-d114-4da5-a1c0-6abbea6d7bf5');
$request->setRequestMethod('GET');
$request->setHeaders([
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

json
{
  "id": "43dbbc35-d114-4da5-a1c0-6abbea6d7bf5",
  "type": "customer_case_bulk_update",
  "company_id": "aff00be6-f734-4094-a8ae-62874485dac0",
  "start_time": "2024-02-21 10:21:31",
  "end_time": "2024-02-21 10:21:35",
  "status": "completed",
  "message": "---------------------------\nCase ID: 4528a261-917d-4cbc-939e-7ea48cffca69 failed with the following errors:\n\nCase does not exist or record already updated.\n------------------------------------------------------\nCase ID: 53c3a84d-8eef-4015-8bc6-499f8eccd161 failed with the following errors:\n\nCase does not exist or record already updated.\n---------------------------",
  "total_records": 773,
  "effected_records": 770,
  "created_at": "2024-02-21T10:21:31.000000Z",
  "updated_at": "2024-02-21T10:21:35.000000Z"
}
json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "type": {
      "type": "string"
    },
    "company_id": {
      "type": "string"
    },
    "start_time": {
      "type": "string",
      "format": "date-time"
    },
    "end_time": {
      "type": "string",
      "format": "date-time"
    },
    "status": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "total_records": {
      "type": "integer"
    },
    "effected_records": {
      "type": "integer"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": ["id", "type", "company_id", "start_time", "end_time", "status", "message", "total_records", "effected_records", "created_at", "updated_at"]
}