Hi, I’m trying to get tasks based on date value.
I’m using this:
data = {
'filterGroups': [
{
'filters': [
{
'propertyName': 'createdate',
'operator': 'GT',
'value': '2023-09-01T00:00:00Z',
},
],
},
],
"sorts": [""],
"properties": ["hs_task_body","hs_task_priority","hs_task_status","hs_task_subject","hs_timestamp","hubspot_owner_id"],
"limit" : "100",
"after": afterp
}
headers = {“Authorization”: "Bearer "+token}
response = requests.post(‘https://api.hubapi.com/crm/v3/objects/tasks/search’, headers=headers, json=data)
but my response is giving this:
{“status”:“error”,“message”:“There was a problem with the request.”,“correlationId”:“8aa1e3ee-7ec7-431a-b441-65d9d8336c64”}
Someone can help me?
Just found out that I was using the wrong default properties name to createdate. The correct in that case is:
hs_createdate
So:
data = {
'filterGroups': [
{
'filters': [
{
'propertyName': 'hs_createdate',
'operator': 'GT',
'value': '2023-09-01T00:00:00Z',
},
],
},
],
"sorts": [""],
"properties": ["hs_task_body","hs_task_priority","hs_task_status","hs_task_subject","hs_timestamp","hubspot_owner_id"],
"limit" : "100",
"after": afterp
}
Does anyone knows how to get the deal ID from this call that I’ve made?
Hi @RCarvalho 
Has the correct create date property name solved your problem, or are you still experiencing an issue here?
Yes. I need to get the deal ID from tha task that I’ve recorver. How can I do that?
Hi @RCarvalho 
As far as I’m aware, you’ll need to perform another request. I recommend the batch read associations endpoint, which you can find within this documentation. Here’s an example request:
{
"inputs": [
{
"id": "123"
},
{
"id": "456"
}
]
}
Where “123” and “456” are example Task IDs.
And here’s an example of the response you should expect:
{
"status": "COMPLETE",
"results": [
{
"from": {
"id": "123"
},
"to": [
{
"toObjectId": 987,
"associationTypes": [
{
"category": "HUBSPOT_DEFINED",
"typeId": 216,
"label": null
}
]
}
]
},
{
"from": {
"id": "456"
},
"to": [
{
"toObjectId": 987,
"associationTypes": [
{
"category": "HUBSPOT_DEFINED",
"typeId": 216,
"label": null
}
]
}
]
}
],
"startedAt": "2023-09-13T23:16:03.085Z",
"completedAt": "2023-09-13T23:16:03.095Z"
}
Where 987 is the example Deal ID you’re looking for.
I hope this proves useful. Please let me know if you have any follow-up questions.