APIs & Integrations

KYilmaz
参加者

How to access the Line-items (including all values like MRR and Margin) of an deal with the API?

解決

Hello everyone,

 

I was trying to figure out how to access the Line-items of an Deal and receive all Values which are shown in the interface. The only think I was able to figure out was how to get the assigned Line-items to a deal but it only gives me the IDs of the Line-items. 

 

And I'm looking for these values:

KYilmaz_0-1617097365426.png

 

Any ideas?

0 いいね!
1件の承認済みベストアンサー
cathalhopper
解決策
HubSpot Employee
HubSpot Employee

How to access the Line-items (including all values like MRR and Margin) of an deal with the API?

解決

Hey @KYilmaz, thanks for the reply!

 

Most* of those properties are deal properties so they can be pulled directly using the deals API - this would again be done by specifying those properties in parameters using ?properties=
Please see an example below:

https://api.hubapi.com/crm/v3/objects/deals/{dealID}?properties=hs_tcv,hs_acv,hs_arr,hs_mrr,amount&hapikey=your_HubSpot_APIkey

 

*Note: the Margin property is a line item property only and not a deal property, and can't be pulled via the deals API > you would need to use the line items API per line item to get that information!

 

Hopefully that's helpful 🙂

元の投稿で解決策を見る

3件の返信
cathalhopper
HubSpot Employee
HubSpot Employee

How to access the Line-items (including all values like MRR and Margin) of an deal with the API?

解決

Hey @KYilmaz !

It sounds like you're using the get deal by ID to get the deal details ( and are getting the line items that way!)

To get the rest of the details of the line items you will want to GET/Read line item endpoint listed here: https://developers.hubspot.com/docs/api/crm/line-items

/crm/v3/objects/line_items/{lineItemId}

This will return information such as the amount (total), quanitity, and some other info like the product ID it is linked to.

 

You can also include additional properties via parameters to include more information, if you're looking for some specific info on the line item!

To do this include the properties parameter with comma separated properties.

Example: you could add the parameters for SKU and term by including ?properties=hs_sku,hs_recurring_billing_period

 

Hopefully that helps! 🙂

KYilmaz
参加者

How to access the Line-items (including all values like MRR and Margin) of an deal with the API?

解決

Hey, 

 

thanks for the reply. I was more looking to get alle the Data from the Deal since the quantity and term can be changed per Deal. Is there a way to get the line-items and there value per Deal or can I just get the line-item individually?

 

For refernce I'm looking for these values: 

KYilmaz_0-1617173341901.png

 

0 いいね!
cathalhopper
解決策
HubSpot Employee
HubSpot Employee

How to access the Line-items (including all values like MRR and Margin) of an deal with the API?

解決

Hey @KYilmaz, thanks for the reply!

 

Most* of those properties are deal properties so they can be pulled directly using the deals API - this would again be done by specifying those properties in parameters using ?properties=
Please see an example below:

https://api.hubapi.com/crm/v3/objects/deals/{dealID}?properties=hs_tcv,hs_acv,hs_arr,hs_mrr,amount&hapikey=your_HubSpot_APIkey

 

*Note: the Margin property is a line item property only and not a deal property, and can't be pulled via the deals API > you would need to use the line items API per line item to get that information!

 

Hopefully that's helpful 🙂