Fellow developers! I’ve been rummaging around the API documentation and the Community to try and find a way to GET all line items specific to a Quote. I am able to list all Quotes or all Line Items, but am at a loss to find how to get line items for a given quote. Didn’t see a way to give Quote ID as a parameter to the line_items endpoint… am I missing something simple? Thanks in advance for any help.
Hi @CBabbage
If you want to get line items associated with the quote then you will have to follow the following steps:
- Firstly you have to get the line item ID from the following API hit. I am sharing curl with you.
curl --request GET \
--url 'https://api.hubapi.com/crm/v3/objects/quotes/{quoteId}?associations=line_items&archived=false' \
--header 'authorization: Bearer YOUR_ACCESS_TOKEN'
2. Secondly you will have to get a line item ID from the above response and this id should be used in the next API hit. I am sharing curl with you.
curl --request GET \
--url 'https://api.hubapi.com/crm/v3/objects/line_items/{lineItemId from response}?archived=false' \
--header 'authorization: Bearer YOUR_ACCESS_TOKEN'
I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!
Thank you @GRajput. This was quite helpful. Extending your answer, I’ll adopt a 3-step solution now:
1) Enumerate Quotes using https://api.hubapi.com/crm/v3/objects/quotes
2) For each Quote, get Line Items using your answer, that is https://api.hubapi.com/crm/v3/objects/quotes/{quoteID}?associations=line_items&archived=false
3) For each Line Item get the necessary fields using "https://api.hubapi.com/crm/v3/objects/line_items/{lineItemID}?properties=hs_product_id,name,description,hs_object_source_id,hs_product_type,hs_sku,hs_variant_id,price,quantity"
Thanks again!