APIs & Integrations

RPanfili
メンバー | Elite Partner
メンバー | Elite Partner

Request uri too long

Hello there, we encountered an issue filtering by properties on this endpoint: Get contacts in a list (https://developers.hubspot.com/docs/methods/lists/get_list_contacts)

 

If we specify too many properties the url become too long and we got an error.

This is very similar to this but since the endpoint does not support POST method (only GET) we are unable to send them as request content.

 

Any tips about?

 

5件の返信
polskyedd
メンバー

Request uri too long

Under Apache, the limit is a configurable value, LimitRequestLine. Change this value to something larger than its default of 8190 if you want to support a longer request URI. Extremely long URLs are usually a mistake. If you keep URLs under 2000 characters , they'll work in virtually any combination of client and server software. URI actually have a character limit depending on several things. Chrome limits url length of 2MB for practical reasons and to avoid causing denial-of-service problems in inter-process communication. On most platforms, Chrome's omnibox limits URL display to 32kB ( kMaxURLDisplayChars ) although a 1kB limit is used on VR platforms. IE - 2083 characters, Firefox - 2047 characters, Safari 80000 characters and Opera 190,000 characters.

To resolve the problem :

 

  • By POST request: Convert query string to json object and sent to API request with POST
  • By GET request: Max length of request is depend on sever side as well as client side. Most webserver have limit 8k which is configurable. On the client side the different browser has different limit. The browser IE and Safari limit to 2k, Opera 4k and Firefox 8k. means the max length for the GET request is 8k and min request length is 2k.

 

If exceed the request max length then the request truncated outside the limit by web server or browser without any warning. Some server truncated request data but the some server reject it because of data lose and they will return with response code 414 Request-URI Too Long.

 

0 いいね!
lynton
投稿者 | Elite Partner
投稿者 | Elite Partner

Request uri too long

Leave the properties parameter blank to receive all properties for the contact. It sounds like you are trying to fetch a lot of properties, so consider setting propertyMode=value_only to minimize the response payload size.

 

Lastly, consider using the CRM v3 API for more flexible search options and cleaner json payloads.

RPanfili
メンバー | Elite Partner
メンバー | Elite Partner

Request uri too long

Thanks Lynton for your suggestion but this does not work. If we don't specify properties as
```
https://api.hubapi.com/contacts/v1/lists/11/contacts/all?&count=100&formSubmissionMode=none&property...
```
we fetch contacts with only a subset of properties, in this case only:
"firstname"
"lastmodifieddate"
"lastname"

 

if I explict query for properties like 

```

https://api.hubapi.com/contacts/v1/lists/11/contacts/all?&count=100&formSubmissionMode=none&property...

```

I receive contacts with all these props, as expected.

Also talking about API v3 can you please help us identify which endpoint can replace the old contactList v1 we are still using? As far as I can see this is still work in progress so we cannot migrate to v3: https://community.hubspot.com/t5/APIs-Integrations/API-V3-Get-all-contacts-with-their-list-details/t...

 

 

 

0 いいね!
RPanfili
メンバー | Elite Partner
メンバー | Elite Partner

Request uri too long

Any update on this?

dennisedson
HubSpot製品開発チーム
HubSpot製品開発チーム

Request uri too long

@RPanfili 

I feel like you could still use the crm search for this.

You could also look into a library. I know that the php library has a function that will get all properties of an object.

@lynton any additional thoughts here?

0 いいね!