I had a question around the deals API. It looks like the structure looks like this:
{
“id”: “123”,
“properties”: {
“amount”: null,
“closedate”: “2019-05-16T20:29:15.916Z”,
“createdate”: “2019-01-18T19:43:52.457Z”,
“dealname”: “FOO BAR”,
“dealstage”: “closedlost”,
“hs_lastmodifieddate”: “2022-05-24T14:49:32.259Z”,
“hs_object_id”: “474346956”,
“pipeline”: “default”
},
“createdAt”: “2019-01-18T19:43:52.457Z”,
“updatedAt”: “2022-05-24T14:49:32.259Z”,
“archived”: false
}
However, the API docs mentioned there being a bunch more “default” properties for deals at HubSpot's default deal properties
How do we get those properties in the API response?
Hi, @joshholat
Thanks for reaching out. To help me clarify, can you give me an example of the following, please?
- The specific endpoint you are using. For example, the v1 Get a deal or the v3 Get deal endpoints.
- The request (minus your authorization key)
- The JSON response body
You can add additional properties to your query. There isn’t a method to include all default options specially, but you can customize which properties you want returned. From the documentation — “Control what is returned via the properties query param.”
Here’s a quick example using the
GET /crm/v3/objects/deals/{dealId}
-
I want the default Deal properties of Owner Assigned Date and Created by user ID included in my query
-
curl --request GET \
--url 'https://api.hubapi.com/crm/v3/objects/deals/9475998565?properties=hs_created_by_user_id%2C%20hubspot_owner_assigneddate&archived=false' \
--header 'authorization: Bearer MY_PRIVATE_APP'
-
Which returns a HTTP 200 response of
{
"id": "9475998565",
"properties": {
"createdate": "2022-07-12T20:51:32.292Z",
"hs_created_by_user_id": "10233975",
"hs_lastmodifieddate": "2022-07-13T21:50:34.500Z",
"hs_object_id": "9475998565",
"hubspot_owner_assigneddate": "2022-07-12T20:51:32.292Z"
},
"createdAt": "2022-07-12T20:51:32.292Z",
"updatedAt": "2022-07-13T21:50:34.500Z",
"archived": false
}
-
Make sure you are using the internal value for the properties and not the label. You can find the internal value for any object property by going to Setting>Properties>The object you are using and clicking into a specific property. There will be a</>
symbol you click on to get the internal value
Have fun coding! — Jaycee