APIs & Integrations

SCatlin
Participant

Method for Batch Retrieval of Deals is Vague

SOLVE

I'm trying to pull a list of Deals using a custom property.  I'm using this endpoint:

 
POST/crm/v3/objects/deals/batch/read
 
The documentation is too vague but states that one can "Read a batch of deals by internal ID, or unique property values".  I'm trying to pass a list of values for a custom property in order to get a list of deals that match that property value.  Here's what I'm passing:
 

 

curl --request POST \
	--url 'https://api.hubapi.com/crm/v3/objects/deals/batch/read?archived=false&hapikey=*-*-*-*-*' \
	--header 'content-type: application/json' \
	--data '{
  "inputs": [
    {
      "id": "51349"
    },
    {
      "id": "51350"
    }
  ], 
  "idProperty": "vboe_quote_id", 
  "properties": [
    "amount",
    "hubspot_owner_id",
    "dealname",
    "dealstage"
  ]
}'

 

 

I get the following error message back:

 

{
  "completedAt": "2021-04-13T13:24:04.105Z", 
  "errors": [
    {
      "category": "OBJECT_NOT_FOUND", 
      "context": {
        "ids": [
          "51350", 
          "51349"
        ]
      }, 
      "message": "Could not get some DEAL objects, they may be deleted or not exist. Check that ids are valid.", 
      "status": "error"
    }
  ], 
  "numErrors": 1, 
  "results": [], 
  "startedAt": "2021-04-13T13:24:04.088Z", 
  "status": "COMPLETE"
}

 

 

Note that 'vboe_quote_id' is my custom property but has nothing to do with HubSpot quotes.  So, don't let that mislead you.  🙂

 

What's the correct way to use this endpoint?

 

Thanks

 

-Scot

1 Accepted solution
MichaelC
Solution
Guide | Partner
Guide | Partner

Method for Batch Retrieval of Deals is Vague

SOLVE

Hi @SCatlin 

 

To read batch of deals based on custom properties I myself use v3/objects/deals/search query. 

https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=

 

In my print screen below I have a custom property called "avtalsnummer" and I want to recieve a specific deal with a specific avtalsnummer. If you want to add more search querys or get more results the "filters" is an array and can easly be added with more filters using comas. 

 

More documentation here:

https://developers.hubspot.com/docs/api/crm/deals

Endpoint: Search

hs.jpg

 

Example with many query here (ignore the fact that its the same property I copy pasted

hs2.jpg



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

View solution in original post

3 Replies 3
MichaelC
Solution
Guide | Partner
Guide | Partner

Method for Batch Retrieval of Deals is Vague

SOLVE

Hi @SCatlin 

 

To read batch of deals based on custom properties I myself use v3/objects/deals/search query. 

https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=

 

In my print screen below I have a custom property called "avtalsnummer" and I want to recieve a specific deal with a specific avtalsnummer. If you want to add more search querys or get more results the "filters" is an array and can easly be added with more filters using comas. 

 

More documentation here:

https://developers.hubspot.com/docs/api/crm/deals

Endpoint: Search

hs.jpg

 

Example with many query here (ignore the fact that its the same property I copy pasted

hs2.jpg



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

SCatlin
Participant

Method for Batch Retrieval of Deals is Vague

SOLVE

@MichaelC 

Thanks!  I ended up using the same search endpoint but using some other properties to narrow down the results.  Then, I filter futher in code to get what I need.

 

However, I might modify my code to do what you're suggesting as the result set size is likely to grow as my client uses HubSpot more and more.

 

I appreciate you're taking the time to help out.

dennisedson
HubSpot Product Team
HubSpot Product Team

Method for Batch Retrieval of Deals is Vague

SOLVE

Hey @SCatlin 

Is the vboe_quote_id identified as a unique property?

If you scroll down to the "creating your own unique identifiers" section on this page, you will see an example.

@PCarlson , @MichaelC  are both more talented than I am and may have more insights so adding them here as well