Help

Get data by related table information

Solved
Jump to Solution
983 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Steve_Manatt
4 - Data Explorer
4 - Data Explorer

I have three tables - Organizers, Events and Players. Organizers have events and players are part of an event. I want to pull the most recent event for a particular organizer through the API via a GET, but can’t figure out how to do that.

I’d also like to pull in a particular event by ID. In this case, I’ve pulled the ID of the event into a column (RecordID) via a formula (RECORD_ID()), but don’t know the correct URL parameter to send.

Thanks in advance.

1 Solution

Accepted Solutions
Erin_OHern
6 - Interface Innovator
6 - Interface Innovator

Hi @Steve_Manatt,

Thanks for your question, and welcome to the community! :grinning: Happy to help with this.

This can be done with a GET, using a combination of a few different parameters. Head to the “List records” section of your API docs for details on each param. For this example, I’m assuming that records in the “Events” table have a linked record field for “Organizer”.

  1. First, you’ll want to use the filterByFormula param with a formula like this AND({Organizer} = 'Jane Doe', {Date}<NOW()) to get records with a particular Organizer and a date that is in the past.
  2. Then, you can use the sort parameter with a value like [{field: "Date", direction: "desc"}]to sort results by date, in descending order.
  3. You can also use maxRecords=1, to return only the first record (which should be the most recent event for that organizer).

You should be able to do this with a “Retrieve a record” call, specifying the ID of the record you’d like to retrieve. More info can be found in the “Retrieve a record” section of your table’s API docs.

The suggestions above may not work perfectly for you, depending on how your tables and fields are set up. But I hope this is enough to set you on the right track!

See Solution in Thread

1 Reply 1
Erin_OHern
6 - Interface Innovator
6 - Interface Innovator

Hi @Steve_Manatt,

Thanks for your question, and welcome to the community! :grinning: Happy to help with this.

This can be done with a GET, using a combination of a few different parameters. Head to the “List records” section of your API docs for details on each param. For this example, I’m assuming that records in the “Events” table have a linked record field for “Organizer”.

  1. First, you’ll want to use the filterByFormula param with a formula like this AND({Organizer} = 'Jane Doe', {Date}<NOW()) to get records with a particular Organizer and a date that is in the past.
  2. Then, you can use the sort parameter with a value like [{field: "Date", direction: "desc"}]to sort results by date, in descending order.
  3. You can also use maxRecords=1, to return only the first record (which should be the most recent event for that organizer).

You should be able to do this with a “Retrieve a record” call, specifying the ID of the record you’d like to retrieve. More info can be found in the “Retrieve a record” section of your table’s API docs.

The suggestions above may not work perfectly for you, depending on how your tables and fields are set up. But I hope this is enough to set you on the right track!