Help

Need to retrieve a record based on column data

1058 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Jon_Eynon
6 - Interface Innovator
6 - Interface Innovator

Hi all.
So I am making a custom WP site using AirTables as the core information hub. I have a page of products for sale. These links are made by pulling the record.get(‘URL’) of the product look. Works great! Now once they click on that link they go to the /products/record.get(‘URL’)
in my example it is /products/aviation
It is at this point I need to retrieve the entire record for product aviation. From the documentation it looks like I can’t retrieve unless I have the record id. At this point is my only option to loop through that products table again and run an if statement when I hit the record.get(‘URL’)==aircraft? Seems like alot of trouble to find the id. I can’t bring it over as a queryString on the incoming URL because I need that URL to work WITHOUT that queryString. Any thoughts?
New to it but love the API so far!
Jon

2 Replies 2

Hi @Jon_Eynon - are you able to use the record id as a URL path segment, rather than a query param? So could you use:

https://www.mysite.com/products/rec345Hrtfu754dd

instead of:

https://www.mysite.com/products?recordID=rec345Hrtfu754dd

If so, then a rewrite rule in the htaccess file might work for you:

See this article:

JB

Jon_Eynon
6 - Interface Innovator
6 - Interface Innovator

Thanks for the feedback. I could make some paths out of the IDs and then do some htaccess magic to convert them but the group I am handing this off to would get confused when it came to making a new product.
My work around was to create a URL field in the table. It is essentially the URL that WordPress will make with the product name. As I arrive at the page I grab the end of the URL and find it’s match in the database. From there I query where URL=END OF URL and away I go.
NOTE: I found that querying on the URL and getting the answer from first Airtable lookup was not completing in time for me to start the Select for the product. I had to put a one second delay (JS) for that variable to come around and play with us.
Thanks!
Jon