Magento 2 Product Management
GET PRODUCTS
There are a couple ways we can get the product data:
Google Shopping Feed – An account is created on their SFTP server. There would be a daily Google Shopping Feed for each of the stores generated and placed on the SFTP server for us. This would provide all the product data we need except for inventory
API – There is an OOTB method that can be used now https://ccadmin-m2.stage.guidance.com/swagger#/catalogProductRepositoryV1/catalogProductRepositoryV1GetListGet however there are a couple drawbacks to the OOTB method. It will not have accurate inventory since they do not use Magento OOTB inventory management.
Get Products will be with lowest priority because we will use the google feed to get all the products from Mangento2.
GET INVENTORY
There is an API method that can provide inventory info based on warehouse and SKU, https://ccadmin-m2.stage.guidance.com/swagger#/guidanceMultiWarehouseInventoryManagementV1/guidanceMultiWarehouseInventoryManagementV1GetGet
Get inventory works only if we have activated Get Inventory flag in magento2_seller table and Active = Yes in magento2_connector. Only then we get the stock for all created SKUs in Hemi for that seller and that account (the ones specified in magento2_seller) and we create or update the record in item_location_quantity with the SKU, Quantity in the Location specified in magento2_seller. Please note we need to have available history for this and track all stock changes properly.
Request: GET V1/inventory/warehouses/{warehouseCode}/products/{productSku}Parameters: warehouseCode - we get it from magento2_seller >Warehouse Code productSku - we get it from item > SKU
Sample Request: GET "https://ccadmin-m2.stage.guidance.com/rest/all/V1/inventory/warehouses/au_online/products/2000003053773" -H "accept: application/json" -H "Authorization: Bearer bhhpyso7tb5i5wn0a7oapl0jz99rbqn0"
NO BODY
Sample Response Body:
[
{
"product_sku": "2000003053773",
"warehouse_code": "au_online",
"qty": "0.0000",
"is_in_stock": false
}
]
Sample Response Header:
cache-control: no-store
connection: Upgrade, Keep-Alive
content-length: 97
content-type: application/json; charset=utf-8
date: Tue, 11 May 2021 07:05:02 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
keep-alive: timeout=5, max=100
pragma: no-cache
server: Apache/2.4.29 (Ubuntu)
upgrade: h2
x-frame-options: SAMEORIGIN
x-ua-compatible: IE=edge
This might be too tedious for your purposes, so we could create a custom API method for you to use here. Maybe something where you specify the store and receive a JSON array with all the SKU and quantity for that store? Let us know if that is something you would be interested in and what method parameters would work best for youIn terms of performance we will need to check the options here.
MAPPINGS
Magento Field | Hemi Field | Comment |
---|---|---|
product_sku |
item_location_quantity > SKU | |
qty |
item_location_quantity > Quantity | |
Please note it is important to import the stock in the Hemi location specified in magento2_seller > Location |
Get Inventory will be with lowest priority because we will use the bulk request in order to get the stock from Mangento2.
GET INVENTORY IN BULK
There is an API method that can provide inventory info based on warehouse and SKU, https://ccadmin-m2.stage.guidance.com/swagger#/guidanceMultiWarehouseInventoryManagementV1/guidanceMultiWarehouseInventoryManagementV1GetGet
Get inventory works only if we have activated Get Inventory flag in magento2_seller table and Active = Yes in magento2_connector. Only then we get the stock for all created SKUs in Hemi for that seller and that account (the ones specified in magento2_seller) and we create or update the record in item_location_quantity with the SKU, Quantity in the Location specified in magento2_seller. Please note we need to have available history for this and track all stock changes properly.
Request: POST /V1/Pentagon/inventory/{storeId}Parameters: storeId- we get it from magento2_seller >Store ID
Sample Request: POST "https://ccadmin-m2.stage.guidance.com/rest/all/V1/Pentagon/inventory/31" -H "accept: application/json" -H "Authorization: Bearer dmsve5nxoy7wratj36oadoqh20oyqhln"
NO BODY
Sample Response Body:
[
{
"sku": "2000006079992",
"qty": 0
},
{
"sku": "2000006080004",
"qty": 0
},
{
"sku": "2000006080011",
"qty": 0
},
{
"sku": "2000006080028",
"qty": 0
}
]
Sample Response Header:
cache-control: no-store
connection: Upgrade, Keep-Alive
content-type: application/json; charset=utf-8
date: Thu, 13 May 2021 15:04:49 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
keep-alive: timeout=5, max=100
pragma: no-cache
server: Apache/2.4.29 (Ubuntu)
transfer-encoding: chunked
upgrade: h2
x-frame-options: SAMEORIGIN
x-ua-compatible: IE=edge
MAPPINGS
Magento Field | Hemi Field | Comment |
---|---|---|
sku |
item_location_quantity > SKU | |
qty |
item_location_quantity > Quantity | |
Please note it is important to import the stock in the Hemi location specified in magento2_seller > Location |