APIs & Integrations

AndreyK2478
Member

Search request http 400 error

SOLVE

Hi,

I need to get calls from the last day. According to the docs I made the request:

curl --request POST \
--url https://api.hubapi.com/crm/v3/objects/calls/search \
--header 'authorization: Bearer MY_TOKEN' \
--header 'content-type: application/json' \
--data '{
"filterGroups": [
{
"filters": [
{
"propertyName": "createdAt",
"value": "2024-11-05T00:00:00",
"operator": "GTE"
}
]
}
],
"limit": 200
}'

And got the following error:

{
"status":"error",
"message":"There was a problem with the request.","correlationId":"8b52abf3-b86a-4010-9b3e-511c27959e6e"
}


I wondered - what I did wrong. The error message is not clear.
How can I search by created date?

Thanks for any help.

0 Upvotes
1 Accepted solution
WesQ
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Search request http 400 error

SOLVE

Hi @AndreyK2478 !
Whenever I encounter the, "There was a problem with the request" error.   I try to check the JSON body of my request, because it's probably not what Hubspot API is expecting.

 

In your case, the date format "2024-11-05T00:00:00"is returning an error because it lacks the time zone offset, which HubSpot requires to correctly parse date-time strings. HubSpot typically expects dates in ISO 8601 format, which includes a time zone offset, such as "2024-11-05T00:00:00Z"

 

Try adding a Z at the end of your date format and see if it works.

I suspect also that you are using an incorrect property name. Try using "hs_createdate" instead of "createdAt"

 

{
    "filterGroups": [
        {
            "filters": [
                {
                    "propertyName": "hs_createdate",
                    "value": "2024-11-05T00:00:00Z",
                    "operator": "GTE"
                }
            ] 
        }
    ]
}


You can check property names using the properties API:

"/crm/v3/properties/events"

 

Reference to date format ISO 8601:

https://developers.hubspot.com/beta-docs/guides/api/crm/properties

 

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

 

View solution in original post

8 Replies 8
WesQ
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Search request http 400 error

SOLVE

Hi @AndreyK2478!
Whenever I encounter the, "There was a problem with the request" error.   I try to check the JSON body of my request, because it's probably not what Hubspot API is expecting.

 

In your case, the date format "2024-11-05T00:00:00"is returning an error because it lacks the time zone offset, which HubSpot requires to correctly parse date-time strings. HubSpot typically expects dates in ISO 8601 format, which includes a time zone offset, such as "2024-11-05T00:00:00Z"

 

Try adding a Z at the end of your date format and see if it works.

I suspect also that you are using an incorrect property name. Try using "hs_createdate" instead of "createdAt"

 

{
"filterGroups": [
{
"filters": [
{
"propertyName": "hs_createdate",
"value": "2024-11-05T00:00:00Z",
"operator": "GTE"
}
]
}
]
}


You can check property names using the properties API:

/crm/v3/properties/events

 

Reference to date format ISO 8601:

https://developers.hubspot.com/beta-docs/guides/api/crm/properties

 

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

 

0 Upvotes
WesQ
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Search request http 400 error

SOLVE
{
    "filterGroups": [
        {
            "filters": [
                {
                    "propertyName": "hs_createdate",
                    "value": "2024-11-05T00:00:00Z",
                    "operator": "GTE"
                }
            ] 
        }
    ]
}
0 Upvotes
WesQ
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Search request http 400 error

SOLVE

Testing reply

0 Upvotes
WesQ
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Search request http 400 error

SOLVE
{
    "filterGroups": [
        {
            "filters": [
                {
                    "propertyName": "hs_createdate",
                    "value": "2024-11-05T00:00:00Z",
                    "operator": "GTE"
                }
            ] 
        }
    ]
}
0 Upvotes
WesQ
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Search request http 400 error

SOLVE

I am trying to reply but it seems my replies get deleted.

0 Upvotes
WesQ
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Search request http 400 error

SOLVE

Hi @AndreyK2478!
Whenever I encounter the, "There was a problem with the request" error.   I try to check the JSON body of my request, because it's probably not what Hubspot API is expecting.

 

In your case, the date format "2024-11-05T00:00:00"is returning an error because it lacks the time zone offset, which HubSpot requires to correctly parse date-time strings. HubSpot typically expects dates in ISO 8601 format, which includes a time zone offset, such as "2024-11-05T00:00:00Z"

 

Try adding a Z at the end of your date format and see if it works.

I suspect also that you are using an incorrect property name. Try using "hs_createdate" instead of "createdAt"


You can check property names using the properties API:

"/crm/v3/properties/events"

 

Reference to date format ISO 8601:

https://developers.hubspot.com/beta-docs/guides/api/crm/properties

 

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

 

0 Upvotes
WesQ
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Search request http 400 error

SOLVE

Hi @AndreyK2478 !
Whenever I encounter the, "There was a problem with the request" error.   I try to check the JSON body of my request, because it's probably not what Hubspot API is expecting.

 

In your case, the date format "2024-11-05T00:00:00"is returning an error because it lacks the time zone offset, which HubSpot requires to correctly parse date-time strings. HubSpot typically expects dates in ISO 8601 format, which includes a time zone offset, such as "2024-11-05T00:00:00Z"

 

Try adding a Z at the end of your date format and see if it works.

I suspect also that you are using an incorrect property name. Try using "hs_createdate" instead of "createdAt"

 

{
    "filterGroups": [
        {
            "filters": [
                {
                    "propertyName": "hs_createdate",
                    "value": "2024-11-05T00:00:00Z",
                    "operator": "GTE"
                }
            ] 
        }
    ]
}


You can check property names using the properties API:

"/crm/v3/properties/events"

 

Reference to date format ISO 8601:

https://developers.hubspot.com/beta-docs/guides/api/crm/properties

 

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

 

AndreyK2478
Member

Search request http 400 error

SOLVE

Works with "hs_createdate", but the time format should be like:

"value": "2024-09-01T10:10:56.332Z"
0 Upvotes