# get tasks based on value date

**URL:** <https://community.hubspot.com/t/get-tasks-based-on-value-date/89468>\
**Category:** APIs & Integrations\
**Tags:** timeline-and-extensions-apis\
**Created:** [September 12, 2023, 3:04pm UTC](https://community.hubspot.com/t/get-tasks-based-on-value-date/89468 "2023-09-12T15:04:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RCarvalho](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@RCarvalho](https://community.hubspot.com/u/RCarvalho)\
**Post date:** [September 12, 2023, 3:04pm UTC](https://community.hubspot.com/t/get-tasks-based-on-value-date/89468/1 "2023-09-12T15:04:41Z")

</div>

Hi, I’m trying to get tasks based on date value.

I’m using this:

```lia-code-sample
 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](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?

---

<div class="post-metadata">

**Author:** ![RCarvalho](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@RCarvalho](https://community.hubspot.com/u/RCarvalho)\
**Post date:** [September 12, 2023, 4:53pm UTC](https://community.hubspot.com/t/get-tasks-based-on-value-date/89468/2 "2023-09-12T16:53:17Z")

</div>

Just found out that I was using the wrong default properties name to createdate. The correct in that case is:  
hs\_createdate  
So:

```lia-code-sample
 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
 }

```

---

<div class="post-metadata">

**Author:** ![RCarvalho](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@RCarvalho](https://community.hubspot.com/u/RCarvalho)\
**Post date:** [September 12, 2023, 5:09pm UTC](https://community.hubspot.com/t/get-tasks-based-on-value-date/89468/3 "2023-09-12T17:09:39Z")

</div>

Does anyone knows how to get the deal ID from this call that I’ve made?

---

<div class="post-metadata">

**Author:** ![zach\_threadint](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/zach_threadint/32/46318_2.png) [@zach\_threadint](https://community.hubspot.com/u/zach_threadint)\
**Post date:** [September 12, 2023, 11:13pm UTC](https://community.hubspot.com/t/get-tasks-based-on-value-date/89468/4 "2023-09-12T23:13:11Z")

</div>

Hi @RCarvalho 👋

Has the correct create date property name solved your problem, or are you still experiencing an issue here?

---

<div class="post-metadata">

**Author:** ![RCarvalho](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@RCarvalho](https://community.hubspot.com/u/RCarvalho)\
**Post date:** [September 13, 2023, 9:09pm UTC](https://community.hubspot.com/t/get-tasks-based-on-value-date/89468/5 "2023-09-13T21:09:57Z")

</div>

Yes. I need to get the deal ID from tha task that I’ve recorver. How can I do that?

---

<div class="post-metadata">

**Author:** ![zach\_threadint](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/zach_threadint/32/46318_2.png) [@zach\_threadint](https://community.hubspot.com/u/zach_threadint)\
**Post date:** [September 13, 2023, 11:19pm UTC](https://community.hubspot.com/t/get-tasks-based-on-value-date/89468/6 "2023-09-13T23:19:47Z")

</div>

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](https://developers.hubspot.com/docs/api/crm/associations). Here’s an example request:

- **POST** [https://api.hubapi.com/crm/v4/associations/TASK/DEAL/batch/read](https://api.hubapi.com/crm/v4/associations/TASK/DEAL/batch/read)
- **Headers** :
  - Content-Type: application/json
  - Authorization: Bearer _{{your\_access\_token}}_

- **Request Body (JSON)**:

```lia-code-sample
{
 "inputs": [
 {
 "id": "123"
 },
 {
 "id": "456"
 }
 ]
}

```

Where “123” and “456” are example Task IDs.

And here’s an example of the response you should expect:

```lia-code-sample
{
 "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.
