How do i GET data with parameters

Options
Hi all, new to this whole API thing as i have been working with bubble.io for practically my entire no-code journey. 
Here's the problem:
Im currently working on xano-draftbit and have no problem GETting all records or a single record. 
But how do i work with getting a list of records with a parameters? I can't seem to find an article that teaches how to connect a parameter (e.g search bar in draftbit) with inputs in xano endpoint. 

An example is a table containing dishes of 10 restaurants. When i click on a restaurant i want to GET dishes belonging to that specific restaurant. 

Any help is appreciated and all the best to anyone on their low/no code journey.

Comments

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    Are you having trouble getting draftbit to send the parameters to Xano? Or getting Xano to use the parameters it receives to filter your query? Both can be straightforward, but can give better/terser help if we know which situation we're in. 
  • Wei
    Wei Member
    Options
     The latter. One exercise project im working on is building a food ordering app. So say there's two tables: "restaurant" and "dishes". When a user selects restaurant A from the frontend (draftbit) , it should GET a list of dishes belonging to restaurant A. 

    How do i pass the parameter "Restaurant A" to Xano when making a GET request from the "dishes" table
    Reply
    Like
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
     Great! I can see two approaches:
    1) Make an endpoint specific to dishes for a restaurant. I made this one, called /restaurants/{restaurant_id}/dishes, which could be accessed as /restaurants/1/dishes:   https://www.loom.com/share/b1e39fa4c2fa4cc5948899e0972565bc

    2) Use an add-on to get all the dishes for a restaurant when you query the restaurant. I made a quick video showing this approach here: https://www.loom.com/share/7cc8552f30044b21b0a2c7077028c777
  • Wei
    Wei Member
    Options
     You the man!!!! 
    Was finally able to figure it out. Didn't know that one could use the function stack to search for records in other tables. 

    Thanks for taking the time out to make these videos. Really appreciate it! 
  • Pablo
    Pablo Member
    Options

    Hello, I return to this thread because I can't solve this issue in bubble, I did what you commented with the addon to show the associated content in bubble but I can't get the API call to see the detail to show me that associated content.
    In the first call it works ok, it shows me the content generated by the _hotel addon, but when I make the second call to see only the selected ID in detail, it doesn't show me the addon fields.

    First call "Proximas Encuestas" to obtain a list works fine (i can see _hotel addon fields)


    The second call to see a detailed view "Vista encuesta" don't working fine

    Any idea what i'm doing wrong? Thanks in advance