Hi @devphoenix,
This is expected behaviour, the legacy endpoint will return an object “properties” containing “firstname”, “lastname”, “company” and “lastmodifieddate”:
GET https://api.hubapi.com/contacts/v1/lists/all/contacts/all
RESPONSE (omitting other metadata)
"properties": {
"firstname": {
"value": "Elon"
},
"lastmodifieddate": {
"value": "1691397058351"
},
"company": {
"value": "Tesla"
},
"lastname": {
"value": "Musk"
}
}
You’ll notice in the documentation it states "by default, only a few standard properties will be included in the response data. If you include the ‘property’ parameter, then you will instead get the specified property in the response. This parameter may be included multiple times to specify multiple properties. NOTE: Contacts only store data for properties with a value, so records with no value for a property will not include that property, even if the property is specified in the request URL."
Meaning if we want to retrieve anything outside of the default/standard fields returned we need to include the property parameter in our request. With the legacy endpoint you need to include the parameter multiple times which can be inconvenient at times. (That is not the case with the v3 endpoint).
GET https://api.hubapi.com/contacts/v1/lists/all/contacts/all?property=prop1&property=prop2
RESPONSE
"properties": {
"prop1": {
"value": "xyz"
},
"lastmodifieddate": {
"value": "1692024509925"
},
"prop2": {
"value": "abc"
}
}
With the more recent v3 endpoint. It returns some default properties namely “createdate”, “email”, “firstname”, “lastname”, “hs_object_id” and “lastmodifieddate”.
GET https://api.hubapi.com/crm/v3/objects/contacts
RESPONSE (omitting other metadata)
"properties": {
"createdate": "2023-07-20T16:28:37.941Z",
"email": "peterparker@marvel.com",
"firstname": "Peter",
"hs_object_id": "101",
"lastmodifieddate": "2023-08-14T14:48:29.925Z",
"lastname": "Parker"
}
You can include a query parameter in your request “property” which contains a comma separated list of values of the properties you wish to retrieve.
GET https://api.hubapi.com/crm/v3/objects/contacts?properties=prop1%2Cprop2
RESPONSE
"properties": {
"createdate": "2023-07-20T16:28:37.941Z",
"prop1": "xyz",
"hs_object_id": "101",
"lastmodifieddate": "2023-08-14T14:48:29.925Z",
"prop2": "xyz"
}
In short what you are seeing is expected behaviour and if you use the legacy endpoint you must include the “property” query param for each property you wish to retrieve. If you are using the v3 endpoint you must include the “properties” query param and supply a comma separated list of the properties you wish to retrieve.