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
| Name | Type | Required | Description |
|---|---|---|---|
| api-key | string | Yes | The 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
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | The product name. |
| description | string | Yes | The product description. |
| short_Description | string | Yes | The short product description. |
| brand | string | Yes | The product brand. |
| images | array of string | Yes | The product images. |
| url | string | Yes | The product URL. |
| price | number | Yes | The product price. |
| sku | string | Yes | The product SKU. |
| barcodes | array of string | Yes | The product barcodes. |
| categories | array of CategoryDTO | Yes | The product categories. |
| properties | array of PropertyDTO | Yes | The product properties. |
categories
| Name | Type | Required | Description |
|---|---|---|---|
| categoryId | string | Yes | The category ID. |
| name | string | Yes | The category name. |
| url | string | Yes | The category URL. |
properties
| Name | Type | Required | Description |
|---|---|---|---|
| key | string | Yes | The property key. |
| value | string | Yes | The 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
| Name | Type | Description |
|---|---|---|
| sku | string | The product SKU. |
| accepted | bool | The acceptance status. |
| price | number | The cheapest price found. |
Example
{
"sku": "EX123",
"accepted": true,
"price": 89.99
}
Errors
| Code | Description |
|---|---|
| 400 | One or more validation errors have occurred. |
| 500 | Server 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
}
]