Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Using filterByFormula with GET requests

Topic Labels: API
3856 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Dhruv_Sirohi
4 - Data Explorer
4 - Data Explorer

I have a sheet that stores user information. This is for a club, so the fields are:
NAME, ID, and PHONE NUMBER.

I am hoping to use a GET request to find a user with a specific ID and return their phone number.

By looking at previous forum posts, I can tell that I’d likely want to use filterByFormula, but was confused about how to format the actual GET request and the URL required.

Apologies if I’ve missed anything important, I’m new to the API!

3 Replies 3

Welcome to the Airtable community!

Are you already able to list records, but just need to be able to filter for the specific record you want?

In general, you need to have a formula that exactly matches a formula that you could put in a formula field using the native Airtable interface.

How you put the formula in the request depends on if you are using the official JavaScript node.js client, a community-built client, or basic curl requests. The details are in the api documentation.

The documentation for the Standard REST API is verygood and includes actual values from your base.

Hey! Thanks for the reply.

I can list the records using the example GET request given in the API.

In the examples, filterByFormula is used like such:
For example, to only include records where ID isn’t empty, pass in NOT({ID} = '') as a parameter like this:

filterByFormula=NOT%28%7BID%7D%20%3D%20%27%27%29

Would I just append this statement to the end of the request URL?

Yes, if you are using curl, you append the parameter to the end of the url. There is a ? in front of the first parameter, and additional parameters are separated with &.

If there are no other parameters, you would put
?filterByFormula=NOT%28%7BID%7D%20%3D%20%27%27%29
at the end of the table endpoint url.

If there already are other parameters (such as max records, a view, sorts, fields, etc) put
&filterByFormula=NOT%28%7BID%7D%20%3D%20%27%27%29
a the end of the url.

Note that if your ID is the internal value returned by the RECORD_ID() formula field you can also get the record by using the record endpoint url in the documentation.