URL length limitations for web API requests
  • 14 Mar 2024
  • 1 Minuto para leer
  • Oscuro
    Ligero
  • PDF

URL length limitations for web API requests

  • Oscuro
    Ligero
  • PDF

The content is currently unavailable in Spanish. You are viewing the default English version.
Resumen del artículo

Requests to Airtable’s Web API are limited to a 16,000-character URL length. Requests exceeding this character limit typically involve complex formulas and filtering workflows, significantly increasing URL lengths when passed as query parameters. This article covers the necessary details and alternative workarounds if your workflow exceeds this limit.

URL length limitations for web API requests workarounds

If your workflow request exceeds 16,000 characters, we recommend trying one of the following alternatives:

Use POST instead of GET

We created a new POST version of the existing GET list table records endpoint, allowing you to pass the options you may currently use through query parameters as JSON in the request body instead. This new POST version will significantly reduce URL length because these parameters are no longer included in the URL.

  • GET endpoint: https://api.airtable.com/v0/BASE_ID/TABLE_ID_OR_NAME

  • POST endpoint: https://api.airtable.com/v0/BASE_ID/TABLE_ID_OR_NAME/listRecords

Note

The key to this change is the use of listRecords at the end of the URL.

This example details GET requests for retrieving table records that include multiple query parameters:

curl 
https://api.airtable.com/v0/BASE_ID/TABLE_ID_OR_NAME?cellFormat=string&fields%5B%5D=Field1&fields%5B%5D=Field2&maxRecords=50&pageSize=10&filterByFormula=%7BDays%20overdue%7D%20%3E%203 \
  -H "Authorization: Bearer YOUR_API_KEY"

Following the addition of a new POST route, this same request would be made like this where the query parameters are now part of the request body:

curl -X POST https://api.airtable.com/v0/BASE_ID/TABLE_ID_OR_NAME/listRecords \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "cellFormat": "string",
  "fields": ["Field1", "Field2"]
  "maxRecords": 50,
  "pageSize": 10,
  "filterByFormula": "{Days overdue} > 3"
}'

Note

To use the timeZone and userLocale parameters, the following query parameters are required:

curl -X POST https://api.airtable.com/v0/BASE_ID/TABLE_ID_OR_NAME/listRecords?timeZone=Europe%2FLondon&userLocale=en-gb  \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "cellFormat": "string",
  "fields": ["Field1", "Field2"]
  "maxRecords": 50,
  "pageSize": 10,
  "filterByFormula": "{Days overdue} > 3"
}'

Use a filtered view

To continue making the same GET request for listing table records, create a separate table view — including all the filtering typically used to pass using query parameters. Next, pass the view ID with the request instead of including filterByFormula:

curl https://api.airtable.com/v0/BASE_ID/TABLE_ID_OR_NAME?view=Grid%20view \
  -H "Authorization: Bearer YOUR_API_KEY"

Note

In rare cases where you cannot resolve this with a view, we recommend using the first option of using the POST endpoint.

Using Airtable.js

If your workflow involves making requests using Airtable.js, we have already made a change to address this with the latest version of the SDK. To take advantage of this, you will just need to update the version you are using to 0.11.5 or higher.


¿Te ha sido útil este artículo?