Skip to main content

Curl get records by field

  • June 6, 2022
  • 5 replies
  • 60 views

Forum|alt.badge.img

Hi,

I want to get from a table all the records, filtered by one of the columns.
For example: I have a field called “SKU”. There are many records in the table with the same SKU, different dimensions of the same products.
I want to get, with CURL, all the records with SKU = 1000.
How can I do that?

Thanks!

5 replies

Forum|alt.badge.img+19
  • Inspiring
  • 3263 replies
  • June 6, 2022

Forum|alt.badge.img
  • Author
  • New Participant
  • 2 replies
  • June 6, 2022

Thanks for your reply, but it doesn’t work for me yet.
I try to write like that:
https://api.airtable.com/v0/MY_APP_KEY/MY_TABLE_NAME?filterByFormula=SEARCH(“SKU”%2C+“1001”)

or in a language that human can understand: SEARCH(“SKU”, “1001”)

I get an empty array. I have more then 30 records with 1001 in the SKU column.

What can be the problem?


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • June 6, 2022

Thanks for your reply, but it doesn’t work for me yet.
I try to write like that:
https://api.airtable.com/v0/MY_APP_KEY/MY_TABLE_NAME?filterByFormula=SEARCH(“SKU”%2C+“1001”)

or in a language that human can understand: SEARCH(“SKU”, “1001”)

I get an empty array. I have more then 30 records with 1001 in the SKU column.

What can be the problem?


Put your field name in curly braces, not quotes.
If your field value is a text string, make sure you put the value in straight quotes, not curly quotes. Also put the string to find first.
If your field value is a number, remove the quotes and use an equation.

SEARCH("1001", {SKU})

or

{SKU} = 1001

Try testing the formula in a formula field in the base to make sure it works.


Forum|alt.badge.img+19
  • Inspiring
  • 3263 replies
  • June 6, 2022

Thanks for your reply, but it doesn’t work for me yet.
I try to write like that:
https://api.airtable.com/v0/MY_APP_KEY/MY_TABLE_NAME?filterByFormula=SEARCH(“SKU”%2C+“1001”)

or in a language that human can understand: SEARCH(“SKU”, “1001”)

I get an empty array. I have more then 30 records with 1001 in the SKU column.

What can be the problem?


Nothing about cURL is a language humans can understand. :winking_face: But now that this additional requirement has been exposed, I shall ponder it. In the meantime - I suspect you are experiencing URI encoding issues in your attempt.


Forum|alt.badge.img
  • Author
  • New Participant
  • 2 replies
  • June 7, 2022

Put your field name in curly braces, not quotes.
If your field value is a text string, make sure you put the value in straight quotes, not curly quotes. Also put the string to find first.
If your field value is a number, remove the quotes and use an equation.

SEARCH("1001", {SKU})

or

{SKU} = 1001

Try testing the formula in a formula field in the base to make sure it works.


It works!! Thank you so much :slightly_smiling_face: