APIs & Integrations

Bernardo_Cobli
Participant

Maximum length of GET request for the API

Hi,

 

I'm using the "get all tickets"(https://developers.hubspot.com/docs/methods/tickets/get-all-tickets) API call, but I'm trying to get around  600 properties, some with very long names. If I try to get them all in one call I receive "414 Request-URI Too Large", which is expected, but I was unable to find what is the maximum size allowed.
Trying different numbers I discovered the with a URL request of about 16300 I can still perform the request.
My question is, can I trust that this number will be mantained? Do you have a more precision definition? is this a constant for all requests?

0 Upvotes
6 Replies 6
CAS-FHQ
Participant

Maximum length of GET request for the API

Sorry wasn't clear I realise (given there is a thing called lists).

All of the object APIs have a list capability (i.e. get all data)
https://developers.hubspot.com/docs/api/crm/contacts
GET/crm/v3/objects/contacts
They are GET, not POST.  To retrieve properties you have to pass the properties array on the URL as a parameter so you get something like this

 

curl --request GET \
  --url 'https://api.hubapi.com/crm/v3/objects/contacts?limit=100&properties=email%2Csomecustomproperty%2Canothercustomproperty&archived=false&hapikey=YOUR_HUBSPOT_API_KEY'

 

if you want every property you have to put them all on the URL query string.

0 Upvotes
CAS-FHQ
Participant

Maximum length of GET request for the API

Two questions

1) is there a post version of the List API?  (documentation doesn't seem to indicate there is)|
2) Is there a 'get all properties' request (once again documentation doesn't seem to indicate there is)

So both are blockers

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Maximum length of GET request for the API

Hey, @CAS-FHQ. Can you link me to List API documentation you are referring to, please?

I found several POST endpoints for the Lists API:

For Q2, we have the Get all properties endpoint for a specific Object — Get all object properties

 

If you have additional or more specific questions, I'd encourage you to create a new post, as this post is older and posting here may not get you the visibility your question deserves.

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
Mike_Eastwood
Key Advisor | Gold Partner
Key Advisor | Gold Partner

Maximum length of GET request for the API

Hi @Bernardo_Cobli 

 

GET Requests are usually limited to 2,048 Characters.

 

Can you use a different method? e.g. POST?

 

There's no limits (as far as I know) to POST requests.

 

Cheers

Mike

 

 

Bernardo_Cobli
Participant

Maximum length of GET request for the API

Hi @Mike_Eastwood ,

 

Sorry for the delay, the method is described as a GET, so I am gessing that I can't use a POST method.

About the limit, the GET limit is actually defined between client and server, the 2048 limit is a defaut for some browsers, but in this case I was able to get about 16300 characters without an error, so that isn't the limit.

0 Upvotes
Mike_Eastwood
Key Advisor | Gold Partner
Key Advisor | Gold Partner

Maximum length of GET request for the API

Sorry, I wasn't very clear – as far as I know there's a limit to query lengths in a URI.

 

The GET method from the API should return a significant amount of data easily.

 

To me – from the error "414 Request-URI Too Large" I would assume the query URI called by you code is too long. Difficult to know without seeing your code.

 

Can you just request all properties? Then the Request URI would be shorter?

 

Cheers

Mike

 

 

 

0 Upvotes