Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Oct 28, 2021 12:14 PM
I built a small table and am accessing it via Airtable API.
Any tip as to how I can randomize the results I’m getting?
Meaning: for each API call, get the value of a different row.
Cheers
Solved! Go to Solution.
Oct 28, 2021 03:05 PM
Welcome to the Airtable community!
The REST API is not designed to return random records. You can get the specific record you request, you can get records in a specific sort order, or you can get records in default order.
If you want a random record, you will need a method of adding that randomness in your code. For example, you could do an initial query of only the record IDs for all the records in the table, pick a random record ID, and then request that specific record. If your table has many records, this may be very cumbersome.
Oct 28, 2021 03:05 PM
Welcome to the Airtable community!
The REST API is not designed to return random records. You can get the specific record you request, you can get records in a specific sort order, or you can get records in default order.
If you want a random record, you will need a method of adding that randomness in your code. For example, you could do an initial query of only the record IDs for all the records in the table, pick a random record ID, and then request that specific record. If your table has many records, this may be very cumbersome.