Products
Operation related to products in 1convo system
Structure
Product structure
| Field name | Types | Required/Optional | Description |
|---|---|---|---|
| name | string(100) | R | Product's name |
| brand | string(30) | R | Product's brand |
| description | string(100) | O | Product's description |
| productCode | string(30) | R | Product's code |
| images | list of object | O | Product's images |
| price | number(10) | R | Product's price |
| category | string(30) | O | Product'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 name | Types | Required/Optional | Description |
|---|---|---|---|
| src | string(30) | R | Image url for products (Https expected) |
Create product
Resource method
POST
Endpoint
/v1/products
Parameters
Body parameters
| Field name | Types | Required/Optional | Description |
|---|---|---|---|
| name | string(100) | R | Product's name |
| brand | string(30) | R | Product's brand |
| description | string(100) | O | Product's description |
| productCode | string(30) | R | Product's code |
| images | list of object | O | Product's images |
| price | number(10) | R | Product's price |
| category | string(30) | O | Product'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 name | Types | Required/Optional | Description |
|---|---|---|---|
| page | number(10) | R | Page number |
| pageSize | number(10) | R | Page 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 name | Types | Required/Optional | Description |
|---|---|---|---|
| productCode | string(30) | R | Product 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:
- System fetches
Productwith givenproductCode - System updates
Productinformation based on given information - System updates all
ProductSKUsinformation underProductbased on given information
Resource method
PATCH
Endpoint
/v1/products/:productCode
Parameters
URL parameter
| Field name | Types | Required/Optional | Description |
|---|---|---|---|
| productCode | string(30) | R | Product code |
Body parameters
| Field name | Types | Required/Optional | Description |
|---|---|---|---|
| name | string(100) | O | Product's name |
| brand | string(30) | O | Product's brand |
| description | string(100) | O | Product's description |
| productCode | string(30) | O | Product's code |
| defaultPrice | number(10) | O | Product's price |
| unit | string(20) | O | Product's unit |
| weight | string(20) | O | Product's weight |
| dimension | list of number | O | Product'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:
- System fetches
Productwith givenproductCode - System updates
Productinformation based on given information - System updates all
ProductSKUsinformation underProductbased on given information
Resource method
PATCH
Endpoint
/v1/products
Parameters
Body parameters
| Field name | Types | Required/Optional | Description |
|---|---|---|---|
| name | string(100) | O | Product's name |
| brand | string(30) | O | Product's brand |
| description | string(100) | O | Product's description |
| productCode | string(30) | O | Product's code |
| defaultPrice | number(10) | O | Product's price |
| unit | string(20) | O | Product's unit |
| weight | string(20) | O | Product's weight |
| dimension | list of number | O | Product'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 name | Types | Required/Optional | Description |
|---|---|---|---|
| productCode | string(30) | R | Product 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 name | Types | Required/Optional | Description |
|---|---|---|---|
| inventory | number(10) | R | Inventory |
| action | string(10) | O | Action (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 name | Types | Required/Optional | Description |
|---|---|---|---|
| inventory | number(10) | R | Inventory |
| productCode | string(30) | R | Product's code |
| action | string(10) | O | Action (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