Deleting a line item using ExternalObjectId

Hi,
I’m trying to develop an integration from an e-commerce platform to HubSpot using HubSpot eCommerce bridge API. I use a unique ExternalObjectId for any object in sync messages. All fine but how can I get a synced object in HubSpot by its ExternalObjectId? There is no request endpoint which takes a parameter as ExternalObjectId and returns the corresponding object. My current problem is that I want to delete some line items from a deal but it can’t be done by sync messages because as the document says “Please note: that the DELETE action type will not remove the object from HubSpot, it will prevent it from syncing in the future.” I can’t delete them by sync messages and also I don’t have their object Id in HubSpot to delete them using the delete line item endpoint documented Accounts Dashboard | HubSpot. So, what can I do to delete some line items from a deal?
Thanks in advance.

Hey @Resanehlab !

Going to tag in @umakantmwb and @himanshurauthan here! They make the web better :smiley:

Thanks for mentioning @dennisedson !

Hi @Resanehlab !
Yes there is no direct api to delete an object using ExternalObjectId for now.
But your requirement of deleting line item from deal can be achieved by using - get deal line items associations by using deal id and associations=line_items, In response you’ll get line items details with line item id, you can filter out the line items you want to delete/update and perform the action usin line item id.
Hope this helps!
Himanshu

Hi Himanshu,

Thanks for the reply but as I mentioned before, I’m using HubSpot eCommerce bridge API and I only have the ExternalObjectId for any object. I don’t have any information and idea about the object ids in HubSpot like deal Id for every deal. How can I access the deal Id for a deal when I sync orders to deals using HubSpot sync messages?

Hey @Resanehlab ,
You can search the deal using the ExternalObjectId, i am supposing that if you are using the eComm bridge api you are creating deal for order or passing the ExternalObjectId in ip__ecomm_bridge__order_number.

using search api you can get the deal ID using the ExternalObjectId.

Thanks,
Himanshu

Thanks. Now I can get a deal with its corresponding ExternalObjectId but when I try to get line items associated with a deal through the CRM Associations API https://api.hubapi.com/crm-associations/v1/associations/dealId/HUBSPOT_DEFINED/19

I’m getting this response: “Error 405 Method Not Allowed”

Am I missing something?

Thanks!

Hey @Resanehlab !
I recommend you to please migrate on v3 and using this endpoint you can get the line items https://api.hubapi.com/crm/v3/objects/deals/dealId?associations=line_items

Thanks,
Himanshu