Get import job by ID - Fabric

Get import job by ID

cURL

curl --request GET \
  --url https://api.fabric.inc/v3/offers-imports-jobs/{jobId} \
  --header 'Authorization: Bearer <token>' \
  --header 'x-fabric-tenant-id: <x-fabric-tenant-id>'
import requests

url = "https://api.fabric.inc/v3/offers-imports-jobs/{jobId}"

headers = {
    "x-fabric-tenant-id": "<x-fabric-tenant-id>",
    "Authorization": "Bearer <token>"
}

response = requests.get(url, headers=headers)

print(response.text)
const options = {
  method: 'GET',
  headers: {'x-fabric-tenant-id': '<x-fabric-tenant-id>', Authorization: 'Bearer <token>'}
};

fetch('https://api.fabric.inc/v3/offers-imports-jobs/{jobId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://api.fabric.inc/v3/offers-imports-jobs/{jobId}",\
  CURLOPT_RETURNTRANSFER => true,\
  CURLOPT_ENCODING => "",\
  CURLOPT_MAXREDIRS => 10,\
  CURLOPT_TIMEOUT => 30,\
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
  CURLOPT_CUSTOMREQUEST => "GET",\
  CURLOPT_HTTPHEADER => [\
    "Authorization: Bearer <token>",\
    "x-fabric-tenant-id: <x-fabric-tenant-id>"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {

url := "https://api.fabric.inc/v3/offers-imports-jobs/{jobId}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("x-fabric-tenant-id", "<x-fabric-tenant-id>")
    req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.fabric.inc/v3/offers-imports-jobs/{jobId}")
  .header("x-fabric-tenant-id", "<x-fabric-tenant-id>")
  .header("Authorization", "Bearer <token>")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.fabric.inc/v3/offers-imports-jobs/{jobId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fabric-tenant-id"] = '<x-fabric-tenant-id>'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body

Responses

200 OK

{
  "id": "643eda1bd4c15c0008b4fb67",
  "startAt": "2023-04-18T17:57:07.260Z",
  "fileName": "coupon/5f689caa4216e7000750d1ef/stg02/1681840413797-coupon.csv",
  "type": "PRICE",
  "details": [
    {
      "timestamp": "2023-04-18T17:57:07.260Z",
      "isSuccess": true,
      "message": "Import coupon codes job started: Tue Apr 18 2023 17:57:47 GMT+0000 (Coordinated Universal Time)"
    }
  ],
  "createdAt": "2019-08-20T14:15:22.000Z",
  "updatedAt": "2019-08-20T14:15:22.000Z",
  "endAt": "2023-04-18T17:57:54.445Z",
  "errorFileName": "coupon/5f689caa4216e7000750d1ef/stg02/1681840413797-error-coupon.csv",
  "errors": [
    {
      "message": "Price should always be >= 0.00",
      "count": 8
    }
  ],
  "totalJob": 10,
  "completedJob": 5,
  "totalRowsCount": 100,
  "insertedRowsCount": 60,
  "failedRowsCount": 40
}

Error Responses

400 Bad Request
{
  "type": "TENANT_HEADER_REQUIRED",
  "message": "x-fabric-tenant-id header is required"
}
401 Unauthorized
{
  "type": "UNAUTHORIZED",
  "message": "Invalid credentials"
}
404 Not Found
{
  "type": "IMPORT_JOB_NOT_FOUND",
  "message": "Import job not found."
}
500 Internal Server Error
{
  "type": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error"
}