I am getting data from the bubble database. I am using the swagger documentation to fetch data. However, I cannot filter the data I am fetching from the database. I am integrating my bubble web app with a mobile application.
Scenario: i have a transactions table with transaction details. How do I fetch all transactions of the logged in user.
When a user is logged in successfully, i would like to show that user all his transactions on the app. How do i go about that.
How do i make that API call.
If you add a constraints
key to your URL params you can define an array of filters - documented here.
In Axios that would look like the below - but however you’re calling in you just need those constraints to end up in your GET request URL params:
let constraintList = [{ "key": "_id", "constraint_type": "equals", "value": *id of user* }];
const limit = 50;
let response = await axios({
method: 'get',
url: *path to your Bubble app's data API*,
params: { 'constraints': JSON.stringify(constraintList), 'limit': limit },
headers: {
'Authorization': 'bearer ' +*your auth token*
}
})