I want users of my app to access the data they have created in Bubble on their own web site, via JSON. Hence I want to expose various data types via the API, based on their own user login credentials that are embedded in the GET url.
Some things I have worked out:
In settings, I’ve enabled “This app exposes a data API”. I’ve selected the types to expose.
I’ve accessed the JSON for those types via the “…api/1.1/obj/type_name” path.
A good start.
Two questions remain.
1) Use of Endpoints
I believe I can access more qualified data by creating an API End Point within the API Workflows section.
I’ve tried that, (see setup below) and I am accessing it with the url:
…api/1.1/obj/endpoint_no_auth_no_privacy
But I’m getting a “type not found” message. Should the URL be different when I’m accessing an endpoint rather than a type?
2) Login API
Since my site will have mulitple users, I need the API to perform a login process. The reference manual discusses this, but the words make no sense to me! Can someone advise me the specific steps to take to set up the URL so that a user login is performed?
Many thanks in anticipation,
Antony.
================================
Reference Manual on Login Authorisation
Create Sign up/Login API workflows. This is useful for building an alternative front-end to the Bubble app, such as a native app that you developed. When an API workflow contains a sign up or login action, then a user ID, token, and expiration, expressed in seconds, are returned with the response of the call. Subsequent calls to the app’s API, with a header Authorization: Bearer API_TOKEN, runs all calls and workflows in the context of the user associated with the token. This user will be the ‘Current user,’ who you can access with actions. Privacy rules will apply to this user as they would if the user was logging in the Bubble app and using it in their own browser. This token should be kept safe.
Yep, you should use wf (for workflow) instead of obj (for a type of thing).
Also the name of the endpoint should be used not the workflow name.
So in your case the endpoint should be:
api/1.1/wf/test_endpoint and not api/1.1/obj/endpoint_no_auth_no_privacy
Create a new workflow endpoint.
Note that the name of the workflow (blue circle) is not the same as the endpoint name (red circle).
In my case below i was using the same name but they can be different.
You will use the Endpoint name in your api calls.
After creating the Endpoint event, create a new login action as shown below.
Note that the fields email, password are from those defined above.
When you click on the dynamic field for both the Email and password the field will be available at the top for you to select.
As the error message states you’re using the wrong method.
API workflows are POST not GET.
And you don’t just enter them as url. You have to call them as API requests from whatever application your calling you’re trying to login from.
Good to hear from you. I didn’t get much further along the line with this one. I only managed to read the JSON data externally with a non password protected situation. My project is quite vast and so I decided to come back to it all another time, and that time doesn’t seem to have arrived yet. It’s not such an obvious topic if you do not have experience in this world of post, get, webhooks etc.
I think the documentation around this may have been updated in the Bubble Reference since I was working on it so I would recommend you reading that in some detail.
As @seanhoots says, you need the app which is receiving the data to be making the request, so I would recommend really digging into that documentation too.
It would be great if you can post anything you find out here!
I know I am late to the party - this article details how to login to Bubble database from external apps (in this case a Dropsource app). It’s a shame Dropsource has not progressed their no code offering further.