The basic process of running a ecomm bridge V2 is:
1. Create a store 2. Syncing product objects with system object id. 3. Creating contacts and deals and kine items
For deals, we send the property values and the object id as per our system ID. For line items, we need a product to be created on HubSpot with product type as PRODUCT.
In your code for dummy product, I can see that you have used line item as object type. It should be PRODUCT.
Next for line items in deals, we need to create those via API with object type LINE ITEM and in this we need to associate a product and a deal. For association we have to pass the value which have been passed as external object id while creating product and deal. This will bind the product as line item to deal.
Q#1: Without Product creation, we won't able to see/create line_items? Ans#1: Yes, a product should exist on HubSpot before creation of a line item.
Q#2: If we started creating Products like the above process, every time it'll create new products to each deal which leads to a duplication of products or do we need to fetch the already created product with externalObjectId? Ans#2: In this case, I will suggest you to please complete the sync of all products to HubSpot and then start creating the line items. Also as if you have noticed then in the sync API we use to send a Parameter called externalObjectId and its the ID of the object at our end which will not be changed anyhow. So even if a sync API is executed for a PRODUCT for multiple times then NO ISSUE. It will be mapped with externalObjectId and no duplicate records will be formed.
The basic process of running a ecomm bridge V2 is:
1. Create a store 2. Syncing product objects with system object id. 3. Creating contacts and deals and kine items
For deals, we send the property values and the object id as per our system ID. For line items, we need a product to be created on HubSpot with product type as PRODUCT.
In your code for dummy product, I can see that you have used line item as object type. It should be PRODUCT.
Next for line items in deals, we need to create those via API with object type LINE ITEM and in this we need to associate a product and a deal. For association we have to pass the value which have been passed as external object id while creating product and deal. This will bind the product as line item to deal.
Q#1: Without Product creation, we won't able to see/create line_items?
Q#2: If we started creating Products like the above process, every time it'll create new products to each deal which leads to a duplication of products or do we need to fetch the already created product with externalObjectId? - tried like this but getting below exception.
Tried to fetch all products and below is the result
Please suggest to me by using which field, can we fetch the exact product created via API?
Q#1: Without Product creation, we won't able to see/create line_items? Ans#1: Yes, a product should exist on HubSpot before creation of a line item.
Q#2: If we started creating Products like the above process, every time it'll create new products to each deal which leads to a duplication of products or do we need to fetch the already created product with externalObjectId? Ans#2: In this case, I will suggest you to please complete the sync of all products to HubSpot and then start creating the line items. Also as if you have noticed then in the sync API we use to send a Parameter called externalObjectId and its the ID of the object at our end which will not be changed anyhow. So even if a sync API is executed for a PRODUCT for multiple times then NO ISSUE. It will be mapped with externalObjectId and no duplicate records will be formed.