APIs & Integrations

purrlo
Participante

Get line_item_id for a specific product

resolver

I am trying to use the API to add a particular product to certain deals. Reading the documentation, I understand this must be done by an object association (definition 19 or 20) using the line_item_id -- however I can't for the life of me locate the line_item_id for this particular product!

 

I've tried to locate by listing all line items, however there are hundreds to filter through, and it doesn't seem to allow searching via product ID. 

 

Is there a simple way to get the appropriate hs_product_id's line_item_id? 

0 Avaliação positiva
1 Solução aceita
himanshurauthan
Solução
Autoridade no assunto | Parceiro Elite
Autoridade no assunto | Parceiro Elite

Get line_item_id for a specific product

resolver

Hii @purrlo 

 

Have you completed running creation of line items API in which we send HS Product Id? Additionally this is the process to do the above:

1. Create Product in HS library using Create a Product . Save the object ID returned from HubSpot at your end.
2. Create a deal and save the deal id at your end
3. Run line items api using Create Line Item . The hs_product_id here is the object id from 1st step. Save the line item object id returned in 202 response.
4. Run Associate CRM objects to associate line items and deals. Use 20 as definition ID to associate line item to deal.

Thanks

Digital Marketing & Inbound Expert In Growth Hacking Technology

Exibir solução no post original

13 Respostas 13
dennisedson
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

Get line_item_id for a specific product

resolver

If you use the get all products endpoint ( https://api.hubapi.com/crm/v3/objects/products ), the hs_product_id will be returned for each. Example:

 "results": [
        {
            "id": "252884638",
            "properties": {
                "createdate": "2020-11-04T16:34:39.975Z",
                "description": "this is a test",
                "hs_lastmodifieddate": "2020-11-04T16:34:39.975Z",
                "hs_object_id": "252884638",
                "name": "Test Product",
                "price": "1"
            },
            "createdAt": "2020-11-04T16:34:39.975Z",
            "updatedAt": "2020-11-04T16:34:39.975Z",
            "archived": false
        }

If you want to create a line item of this product, you will use the hs_object_id that you see in the above block.

Hopefully, I understood the question correctly

0 Avaliação positiva
MarkusHue
Colaborador(a)

Get line_item_id for a specific product

resolver

Hi Dennis,

many thanks for your answer. We are on it and testing with the API V3 at the moment. Best Regards

MarkusHue
Colaborador(a)

Get line_item_id for a specific product

resolver

Hi Dennis,

i´m facing a new question on this topic: As of yet i thought the "Object ID" of an product (which we have already imported into Hubspot and which is created by Hubspot; these value is one of the product values in Hubspot) is the "hs_product_id" (object id is equal to hs_product_id). But it seems to me, that this assumption is not correct. So, where can i see or find the value "hs_product_id" for a single product, which should be included to a Deal? BR Markus

0 Avaliação positiva
MarkusHue
Colaborador(a)

Get line_item_id for a specific product

resolver

Thanks, we´ll check!

0 Avaliação positiva
MarkusHue
Colaborador(a)

Get line_item_id for a specific product

resolver

Hi,

thanks. But still unclear for me, how we create the "line item" or how we can import a product (as a line item) into a specific deal (existing deal id). Here i´m struggling at the moment! BR

0 Avaliação positiva
dennisedson
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

Get line_item_id for a specific product

resolver

@MarkusHue 

When you are creating the line item, you will use that hs_product_id in the post request.  The json body you send would look something like this:

{
  "properties": {
    "hs_product_id": "191902"
  }
}

Can be as simple as that.  You will then get a response which includes the ID for the newly created line item.  With that ID, you will use the associations endpoint to associate this line item with your deal of choice.

Hope that helps!

0 Avaliação positiva
himanshurauthan
Solução
Autoridade no assunto | Parceiro Elite
Autoridade no assunto | Parceiro Elite

Get line_item_id for a specific product

resolver

Hii @purrlo 

 

Have you completed running creation of line items API in which we send HS Product Id? Additionally this is the process to do the above:

1. Create Product in HS library using Create a Product . Save the object ID returned from HubSpot at your end.
2. Create a deal and save the deal id at your end
3. Run line items api using Create Line Item . The hs_product_id here is the object id from 1st step. Save the line item object id returned in 202 response.
4. Run Associate CRM objects to associate line items and deals. Use 20 as definition ID to associate line item to deal.

Thanks

Digital Marketing & Inbound Expert In Growth Hacking Technology
JChen1
Participante

Get line_item_id for a specific product

resolver

@himanshurauthan 

Is there any way to get the Object ID for a Product in the Product Library in the HubSpot frontend UI?  I am using a middleware solution where the the connector does not searching up the Product via API to get that ID.

 

The end goal is using CRM Association to assign a Product (line item) to a Deal, but the only piece I'm missing is the Product ID.

0 Avaliação positiva
MarkusHue
Colaborador(a)

Get line_item_id for a specific product

resolver

Hi,

as i´m searching at the moment for solutions within this topic i´v seen your post. As far as i´ve learned you need this API to getting this id:

https://legacydocs.hubspot.com/docs/methods/products/get_product_by_id

This id is not shown in the product library and cannot be exported.

 

Question: Do you have a solution for your purpose in the meantime (adding products to deals via API)?

Best Regards

 

0 Avaliação positiva
dennisedson
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

Get line_item_id for a specific product

resolver

@MarkusHue , Products cannot be associated with another object.  You will want to look at line items which can be considered a subset of products which can be associated with deals

0 Avaliação positiva
MarkusHue
Colaborador(a)

Get line_item_id for a specific product

resolver

Hi Dennis,

thanks for your answer. Ok, i think i understand this way. But still unclear for me, how we come to the specific line item of a product in a deal. A single product (a unique hs_product_id) - always the same product -  can be sold in different deals. So, we should have different line item ids (for every deal a unique line item id). Am i right?

0 Avaliação positiva
dennisedson
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

Get line_item_id for a specific product

resolver

Yep!

Consider your products as a repository from which you can pull from.  Kind of like a collection.  When you take an individual item from this group, it is then considered a line item and that individual line item is then associated with the deal

0 Avaliação positiva
purrlo
Participante

Get line_item_id for a specific product

resolver

The products and deals already exist, I just thought I could link the two - add product A) to existing deal.

 

I seem to have misunderstood how the line_item_id works - so I need to create a line item for the deal, and then associate the line item to the deal, for each deal instance?

0 Avaliação positiva