Get import jobs - Fabric

Get import jobs

cURL

curl --request GET \
  --url 'https://api.fabric.inc/v3/offers-imports-jobs?size=10' \
  --header 'Authorization: Bearer <token>' \
  --header 'x-fabric-tenant-id: <x-fabric-tenant-id>'

Python

import requests

url = "https://api.fabric.inc/v3/offers-imports-jobs?size=10"

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

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

print(response.text)

JavaScript (fetch)

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?size=10', 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?size=10",
  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;
}

Go

package main

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

func main() {

url := "https://api.fabric.inc/v3/offers-imports-jobs?size=10"

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))
}

Unirest for Java

HttpResponse<String> response = Unirest.get("https://api.fabric.inc/v3/offers-imports-jobs?size=10")
  .header("x-fabric-tenant-id", "<x-fabric-tenant-id>")
  .header("Authorization", "Bearer <token>")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://api.fabric.inc/v3/offers-imports-jobs?size=10")

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

{
  "query": {
    "size": 10,
    "offset": 10,
    "count": 50
  },
  "data": [
    {
      "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

{
  "type": "TENANT_HEADER_REQUIRED",
  "message": "x-fabric-tenant-id header is required"
}
{
  "type": "UNAUTHORIZED",
  "message": "Invalid credentials"
}
{
  "type": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error"
}

Authorization

Headers

Query Parameters

Parameter Type Description
size integer Number of records to be returned on a single page.
offset integer Number of records to skip before returning records.
type enum Required. The import job type for which you want...

Response Status Codes