APIs & Integrations

MWeddup
Participant

deal/batch/read idProperty values using custom properties? is it possible?

SOLVE

The documentation for https://developers.hubspot.com/docs/api/crm/deals endpoint /read lists an "idProperty" but doesn't specify what values or format to use. Removing the field completely results in use of the Deal ID "hs_object_id" and if you use "id" or "hs_object_id" it works, but I want to use a custom property.

e.g. I want to look for Deals with a custom field  "transaction_id" for a batch of records, so I know if I need to use the batch/create or batch/update  

 

trying with "idProperty": "transaction_id" just results in :

"Could not get some DEAL objects, they may be deleted or not exist. Check that ids are valid."

 

Does deal/batch/read allow custom properties or am I missing something?

 

Other people have asked similar questions and are directed to the api/crm/search, but that is not a solution as it only allows 3 filters / 3 filter groups at a time, and I'm bulk updating potentially hundreds of deals (hence my wanting to use the batch option ) and I'd like to avoid having to look up each record as a separate api call

0 Upvotes
1 Accepted solution
JBeatty
Solution
Contributeur de premier rang | Partenaire solutions Platinum
Contributeur de premier rang | Partenaire solutions Platinum

deal/batch/read idProperty values using custom properties? is it possible?

SOLVE

Hi @MWeddup

 

The key here is that the enpdoint sepecifys "unique property values". What this means(though the documentation is a little lacking in this subject), is that the property you are searching for must be unique.

To do this you must create a property from the api. If you use the `/crm/v3/properties/{objectType}` endpoint, you can specify "hasUniqueValue": true. Which will enforce that the properties are unique across all objects, which can then be used for that endpoint.

For example:

JBeatty_0-1643218233220.png

JBeatty_1-1643218351445.png

With the results:

{
  "status": "COMPLETE",
  "results": [
    {
      "id": "6930077741",
      "properties": {
        "amount": "12000",
        "closedate": "2021-11-30T21:34:33.990Z",
        "createdate": "2021-11-15T21:34:33.990Z",
        "deal_unique_identifier": "eb0e42c9-09a9-4199-a4ce-f477a056fb16",
        "dealname": "Jar Jar - New Deal",
        "dealstage": "1634009",
        "hs_lastmodifieddate": "2022-01-26T17:31:00.289Z",
        "hs_object_id": "6930077741",
        "pipeline": "1634002"
      },
      "createdAt": "2021-11-15T21:34:33.990Z",
      "updatedAt": "2022-01-26T17:31:00.289Z",
      "archived": false
    }
  ],
  "numErrors": 1,
  "errors": [
    {
      "status": "error",
      "category": "OBJECT_NOT_FOUND",
      "message": "Could not get some DEAL objects, they may be deleted or not exist. Check that ids are valid.",
      "context": {
        "ids": [
          "6f19b2f7-aaf9-463e-8d79-c3a83d828cdd"
        ]
      }
    }
  ],
  "startedAt": "2022-01-26T17:32:14.267Z",
  "completedAt": "2022-01-26T17:32:14.293Z"
}

 

 

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

View solution in original post

JBeatty
Solution
Contributeur de premier rang | Partenaire solutions Platinum
Contributeur de premier rang | Partenaire solutions Platinum

deal/batch/read idProperty values using custom properties? is it possible?

SOLVE

Hi @MWeddup

 

The key here is that the enpdoint sepecifys "unique property values". What this means(though the documentation is a little lacking in this subject), is that the property you are searching for must be unique.

To do this you must create a property from the api. If you use the `/crm/v3/properties/{objectType}` endpoint, you can specify "hasUniqueValue": true. Which will enforce that the properties are unique across all objects, which can then be used for that endpoint.

For example:

JBeatty_0-1643218233220.png

JBeatty_1-1643218351445.png

With the results:

{
  "status": "COMPLETE",
  "results": [
    {
      "id": "6930077741",
      "properties": {
        "amount": "12000",
        "closedate": "2021-11-30T21:34:33.990Z",
        "createdate": "2021-11-15T21:34:33.990Z",
        "deal_unique_identifier": "eb0e42c9-09a9-4199-a4ce-f477a056fb16",
        "dealname": "Jar Jar - New Deal",
        "dealstage": "1634009",
        "hs_lastmodifieddate": "2022-01-26T17:31:00.289Z",
        "hs_object_id": "6930077741",
        "pipeline": "1634002"
      },
      "createdAt": "2021-11-15T21:34:33.990Z",
      "updatedAt": "2022-01-26T17:31:00.289Z",
      "archived": false
    }
  ],
  "numErrors": 1,
  "errors": [
    {
      "status": "error",
      "category": "OBJECT_NOT_FOUND",
      "message": "Could not get some DEAL objects, they may be deleted or not exist. Check that ids are valid.",
      "context": {
        "ids": [
          "6f19b2f7-aaf9-463e-8d79-c3a83d828cdd"
        ]
      }
    }
  ],
  "startedAt": "2022-01-26T17:32:14.267Z",
  "completedAt": "2022-01-26T17:32:14.293Z"
}

 

 

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

MWeddup
Participant

deal/batch/read idProperty values using custom properties? is it possible?

SOLVE

I had created the transaction_id property via the web interface via settings and properties, I shall remove it and recreate it via the api, thanks for your help

0 Upvotes