[API] Error requesting a single field


The following request works as expected:


But this one fails with status 422 Unprocessable Entity:


The response is:

{"error":{"type":"INVALID_REQUEST_UNKNOWN","message":"Invalid request: parameter validation failed. Check your request data."}}


Also, what does “array of strings” actually mean in the context of an URL-encoded parameter?



Funny thing, repeating the field works:


Clearly there’s a problem with the “array” when it has only one element.

1 Like


Yes, I don’t understand the “array of elements” when it doesn’t work for one element. Airtable should explain it better in the doc



You’re right—this is a little confusing.

If you want to pass a single value, such as maxRecords, you’ll supply it as a normal query parameter. For example:


However, if you want to pass an array, you’ll need to append [] to the end of each key.

For example, imagine you want to list records and only include two fields: “My First Field” and “My Other Field”. You’d send query parameters like this:


If you only wanted one field, you’d still append the [].

Our query parsing is somewhat lenient, which is why supplying the parameter multiple times works. We recommend appending the [] in all cases so that it works when you just want to supply an array with one value.

If you can, we recommend using a client library to avoid some of this. Airtable.js is our official offering, but our API docs mention a few unofficial libraries for other languages. You can use the Airtable API URL Encoder to put together a properly-formatted request if you’re not using a library.

In any case, we’ll plan to update our docs here, because this isn’t clear.