RealTimeProductLookup

POST {{base-url}}/product

Look up a product in real time. This API will return the cheapest price that Teljoy have on the product and if the product was accepted or rejected.

Parameters

Headers

NameTypeRequiredDescription
api-keystringYesThe API key for authentication.

Request

{
  "name": "string",
  "description": "string",
  "short_Description": "string",
  "brand": "string",
  "images": ["string"],
  "url": "string",
  "price": 0,
  "sku": "string",
  "barcodes": ["string"],
  "categories": [
    {
      "categoryId": "string",
      "name": "string",
      "url": "string"
    }
  ],
  "properties": [
    {
      "key": "string",
      "value": "string"
    }
  ]
}

TIP

This API can also accept an array of products. If you want to look up multiple products at once, you can do so by passing an array of products in the request body. The response will be an array of responses, one for each product.

payload

NameTypeRequiredDescription
namestringYesThe product name.
descriptionstringYesThe product description.
short_DescriptionstringYesThe short product description.
brandstringYesThe product brand.
imagesarray of stringYesThe product images.
urlstringYesThe product URL.
pricenumberYesThe product price.
skustringYesThe product SKU.
barcodesarray of stringYesThe product barcodes.
categoriesarray of CategoryDTOYesThe product categories.
propertiesarray of PropertyDTOYesThe product properties.

categories

NameTypeRequiredDescription
categoryIdstringYesThe category ID.
namestringYesThe category name.
urlstringYesThe category URL.

properties

NameTypeRequiredDescription
keystringYesThe property key.
valuestringYesThe property value.

Example

{
  "name": "Example Product",
  "description": "This is an example product.",
  "short_Description": "Example product",
  "brand": "Example Brand",
  "images": ["https://example.com/image1.jpg"],
  "url": "https://example.com/product",
  "price": 99.99,
  "sku": "EX123",
  "barcodes": ["1234567890123"],
  "categories": [
    {
      "categoryId": "1",
      "name": "Electronics",
      "url": "https://example.com/category/electronics"
    }
  ],
  "properties": [
    {
      "key": "color",
      "value": "blue"
    }
  ]
}

Response

{
  "sku": "string",
  "accepted": true,
  "price": 0
}

payload

NameTypeDescription
skustringThe product SKU.
acceptedboolThe acceptance status.
pricenumberThe cheapest price found.

Example

{
  "sku": "EX123",
  "accepted": true,
  "price": 89.99
}

Errors

CodeDescription
400One or more validation errors have occurred.
500Server Error

Bad Request Example

{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "traceId": "698b5f0f-6a3e-4d7b-a2e6-9025a1a7cf8e",
  "errors": {
    "apiKey": ["The apiKey field is required."]
  }
}

Internal Server Error Example

{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "An error occurred.",
  "status": 500,
  "traceId": "05faffa9-1dca-4629-934c-cea9b8637b5c"
}

Example Usage

Here's an example of how to make a POST request to the /api/product endpoint using Javascript and the fetch API:

Single Product

let headersList = {
  Accept: "*/*",
  "api-key": "your_api_key",
  "Content-Type": "application/json",
};

let bodyContent = JSON.stringify({
  name: 'HISENSE 100L5F 10" LASER TV1',
  sku: "100L5F",
  quantity: "1",
  price: "12657.00",
  description: "string",
  short_description:
    "The L5 Laser TV immerses you into a whole new 4K UHD viewing experience.",
  brand: "HISENSE",
  merchant_product_id: "53783",
  images: ["https://atomictest.co.za/wp-content/uploads/2021/11/100L5F.jpeg"],
});

let response = await fetch("http://localhost:3000/api/product", {
  method: "POST",
  body: bodyContent,
  headers: headersList,
});

let data = await response.text();
console.log(data);

Replace your_api_key with your actual API key.

Expected Response

This is an example of the expected response:

{
  "sku": "100L5F",
  "accepted": true,
  "price": 299
}

Multiple Products

let headersList = {
  Accept: "*/*",
  "api-key": "your_api_key",
  "Content-Type": "application/json",
};

let bodyContent = JSON.stringify([
  {
    name: 'HISENSE 100L5F 10" LASER TV1',
    sku: "100L5F",
    quantity: "1",
    price: "12657.00",
    description: "string",
    short_description:
      "The L5 Laser TV immerses you into a whole new 4K UHD viewing experience.",
    brand: "HISENSE",
    merchant_product_id: "53783",
    images: ["https://atomictest.co.za/wp-content/uploads/2021/11/100L5F.jpeg"],
  },
  {
    name: "HISENSE FQP9012VMT 9KG TITANIUM GREY FRONT LOADER",
    description: "",
    short_description: "",
    brand: "HISENSE",
    merchant_product_id: "74883",
    quantity: "1",
    images: [],
    url: "string",
    price: "1.99",
    sku: "ELBASTV9S4EX937N",
    categories: [
      {
        id: "889",
        name: "Washing",
        url: "string",
      },
      {
        id: "753",
        name: "Washing Machine",
        url: "string",
      },
    ],
  },
]);

let response = await fetch("http://localhost:3000/api/product", {
  method: "POST",
  body: bodyContent,
  headers: headersList,
});

let data = await response.text();
console.log(data);

Replace your_api_key with your actual API key.

Expected Response

This is an example of the expected response:

[
  {
    "sku": "100L5F",
    "accepted": true,
    "price": 299
  },
  {
    "sku": "ELBASTV9S4EX937N",
    "accepted": false,
    "price": null
  }
]
Last Updated:
Contributors: rzimanTJY