Products

Operation related to products in Deeple system

Structure

Product structure

Field nameTypesRequired/OptionalDescription
namestring(100)RProduct's name
brandstring(30)RProduct's brand
descriptionstring(100)OProduct's description
productCodestring(30)RProduct's code
imageslist of objectOProduct's images
pricenumber(10)RProduct's price
categorystring(30)OProduct's category name

Example of product structure

{
"name": "string",
"brand": "string",
"productCode": "string",
"description": "string",
"images": [
{
"src": "string"
}
],
"price": 0,
"category": "string"
}

Product's image structure

Field nameTypesRequired/OptionalDescription
srcstring(30)RImage url for products (Https expected)

Create product

Resource method

POST

Endpoint

/v1/products

Parameters

Body parameters

Field nameTypesRequired/OptionalDescription
namestring(100)RProduct's name
brandstring(30)RProduct's brand
descriptionstring(100)OProduct's description
productCodestring(30)RProduct's code
imageslist of objectOProduct's images
pricenumber(10)RProduct's price
categorystring(30)OProduct's category name

Example response object

{
"name": "string",
"brand": "string",
"productCode": "string",
"description": "string",
"images": [
{
"src": "string"
}
],
"price": 0,
"category": "string"
}

Get all products

Resource method

GET

Endpoint

/v1/products

Parameters

Query parameters

Field nameTypesRequired/OptionalDescription
pagenumber(10)RPage number
pageSizenumber(10)RPage size

Example response object

{
"data": [
{
"createdAt": "2020-06-14T20:22:52.777Z",
"updatedAt": "2020-06-14T20:22:52.777Z",
"projectId": 1,
"name": "string",
"brand": "string",
"productCode": "string",
"description": "string",
"images": [
{
"src": "string"
}
],
"deleted": false,
"productSKUs": [
{
"productCode": "string",
"price": 0,
"image": "string",
"variableTypes": []
}
],
"categories": [
{
"name": "string",
"description": "string",
"image": "string",
"isFree": false,
"isActive": true,
"properties": [
{
"name": "string"
}
],
"variations": [
{
"name": "string"
}
]
}
]
}
],
"total": 0
}

Get product by product code

Resource method

GET

Endpoint

/v1/products/:productCode

Parameters

URL parameter

Field nameTypesRequired/OptionalDescription
productCodestring(30)RProduct code

Example response object

{
"createdAt": "2020-06-14T20:22:52.777Z",
"updatedAt": "2020-06-14T20:22:52.777Z",
"projectId": 1,
"name": "string",
"brand": "string",
"productCode": "string",
"description": "string",
"images": [
{
"src": "string"
}
],
"deleted": false,
"productSKUs": [
{
"productCode": "string",
"price": 0,
"image": "string",
"variableTypes": []
}
],
"categories": [
{
"name": "string",
"description": "string",
"image": "string",
"isFree": false,
"isActive": true,
"properties": [
{
"name": "string"
}
],
"variations": [
{
"name": "string"
}
]
}
]
}

Update product information by product code

When system updates product information, system will do as follows:

  1. System fetches Product with given productCode
  2. System updates Product information based on given information
  3. System updates all ProductSKUs information under Product based on given information

Resource method

PATCH

Endpoint

/v1/products/:productCode

Parameters

URL parameter

Field nameTypesRequired/OptionalDescription
productCodestring(30)RProduct code

Body parameters

Field nameTypesRequired/OptionalDescription
namestring(100)OProduct's name
brandstring(30)OProduct's brand
descriptionstring(100)OProduct's description
productCodestring(30)OProduct's code
defaultPricenumber(10)OProduct's price
unitstring(20)OProduct's unit
weightstring(20)OProduct's weight
dimensionlist of numberOProduct's dimension

Example response object

{
"createdAt": "2020-06-14T20:22:52.777Z",
"updatedAt": "2020-06-14T20:22:52.777Z",
"projectId": 1,
"name": "string",
"brand": "string",
"productCode": "string",
"description": "string",
"images": [
{
"src": "string"
}
],
"deleted": false,
"unit": "unit",
"weight": 100,
"dimension": [100, 100, 100],
"productSKUs": [
{
"productCode": "string",
"image": "string",
"variableTypes": [],
"weight": 100,
"dimension": [100, 100, 100]
}
],
"categories": [
{
"name": "string",
"description": "string",
"image": "string",
"isFree": false,
"isActive": true,
"properties": [
{
"name": "string"
}
],
"variations": [
{
"name": "string"
}
]
}
]
}

Bulk update product information

Bulk update products information, system will only support up to 100 products update at once

When system updates product information in bulk, system will do as follows:

  1. System fetches Product with given productCode
  2. System updates Product information based on given information
  3. System updates all ProductSKUs information under Product based on given information

Resource method

PATCH

Endpoint

/v1/products

Parameters

Body parameters

Field nameTypesRequired/OptionalDescription
namestring(100)OProduct's name
brandstring(30)OProduct's brand
descriptionstring(100)OProduct's description
productCodestring(30)OProduct's code
defaultPricenumber(10)OProduct's price
unitstring(20)OProduct's unit
weightstring(20)OProduct's weight
dimensionlist of numberOProduct's dimension

Example request object

[
{
"name": "New product",
"productCode": "VN-001",
"unit": "UNIT1"
},
{
"name": "New product",
"productCode": "VN-002",
"weight": 100
}
]

Example response object

[
{
"createdAt": "2020-06-14T20:22:52.777Z",
"updatedAt": "2020-06-14T20:22:52.777Z",
"projectId": 1,
"name": "string",
"brand": "string",
"productCode": "string",
"description": "string",
"images": [
{
"src": "string"
}
],
"deleted": false,
"unit": "unit",
"weight": 100,
"dimension": [100, 100, 100],
"productSKUs": [
{
"productCode": "string",
"image": "string",
"variableTypes": [],
"weight": 100,
"dimension": [100, 100, 100]
}
],
"categories": [
{
"name": "string",
"description": "string",
"image": "string",
"isFree": false,
"isActive": true,
"properties": [
{
"name": "string"
}
],
"variations": [
{
"name": "string"
}
]
}
]
}
]

Delete product by product code

Resource method

DELETE

Endpoint

/v1/products/:productCode

Parameters

URL parameter

Field nameTypesRequired/OptionalDescription
productCodestring(30)RProduct code

Example response object

200 - OK status

Update product's inventory by product code

Resource method

POST

Endpoint

/v1/products/:productCode/inventory

Parameters

URL parameter

Field nameTypesRequired/OptionalDescription
inventorynumber(10)RInventory
actionstring(10)OAction (Default to ADD)

Action type

{
"ADD": "ADD", // When client need to add inventory (Default action is `ADD`)
"REPLACE": "REPLACE" // When client need to replace inventory
}

Example response object

200 - OK status

Example error response object

400 - Bad request status
Response body
{
"currentAmount": 0,
"productCode": "productCode",
"reservedAmount": 0,
"message": "message"
}

Get product's inventory by product code

Resource method

GET

Endpoint

/v1/products/:productCode/inventory

Parameters

No parameters

Example response object

{
"inventory": 1000,
"reserved": 0
}

Get product's inventories by product code

Resource method

GET

Endpoint

/v1/products/inventory/all

Parameters

productCodes=code1,code2

Example response object

{
"inventory": 1000,
"reserved": 0
"productCode": "productCode",
}

Bulk update product's inventory

Bulk update products inventories, system will only support up to 100 inventory update at once

Resource method

POST

Endpoint

/v1/products/inventory

Parameters

URL parameter

Field nameTypesRequired/OptionalDescription
inventorynumber(10)RInventory
productCodestring(30)RProduct's code
actionstring(10)OAction (Default to ADD)

Action type

{
"ADD": "ADD", // When client need to add inventory (Default action is `ADD`)
"REPLACE": "REPLACE" // When client need to replace inventory
}

Example request object

[
{
"inventory": 100,
"productCode": "VN-001"
},
{
"inventory": 30,
"productCode": "VN-002",
"action": "REPLACE"
}
]

Example response object

200 - OK status
400 - INVENTORY:EXCEEDED_UPDATE_LIMIT