https://supabase.com/ logo
Hello guys, is there a way to call an API and re...
# help
l
Hello guys, is there a way to call an API and return filtered data based on a column's value? in the example below, I want to return data with the "name" = "Football"
Copy code
json

curl 'https://uhqhezqfibinawwjment.supabase.co/rest/v1/Services?id=eq.1&select=*' \
-H "apikey: SUPABASE_KEY" \
-H "Authorization: Bearer SUPABASE_KEY" \
Copy code
json

[
    {
        "id": "18379db8-a931-4ede-9352-7ad719c990bf",
        "created_at": "2022-05-14T10:47:53+00:00",
        "name": "Football",
        "description": "Enjoy with your friends playing football",
        "duration": 60,
        "location": null,
        "slots": 2,
        "price": 25,
        "vendor_id": "aa98fcd2-4d64-420e-80f9-070df422f2d4"
    },
    {
        "id": "fbff8aec-b55c-4372-9bd3-ed7126679285",
        "created_at": "2022-05-15T15:37:27+00:00",
        "name": "Basketball",
        "description": "We play basketball, for fun",
        "duration": 60,
        "location": null,
        "slots": 5,
        "price": 20,
        "vendor_id": "aa98fcd2-4d64-420e-80f9-070df422f2d4"
    }
]
n
Hello @LeDragunov! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
o
Hi You can do that using different filters, as the ``eq`` filter, like that:
Copy code
curl 'https://uhqhezqfibinawwjment.supabase.co/rest/v1/Services?name=eq.Football&select=*' \
-H "apikey: SUPABASE_KEY" \
-H "Authorization: Bearer SUPABASE_KEY" \
@LeDragunov
n
LeDragunov (2022-05-15)
o
Small note: i didn't try this code, so let me know if this one work :p
l
yes, that's it. It's working well 😄 thanks