Access specific fields of a Type via URL

Hi! :slight_smile: I know how to access a specific object of a specific type via URL and constraints (explained in the documentation). Example:

https://coffeesearcher.bubbleapps.io/api/1.1/obj/coffeeshops?api_token=YOUR_API_TOKEN&constraints=%5B%7B%22key%22%3A%22name%22%2C%22constraint_type%22%3A%22text%20contains%22%2C%20%22value%22%3A%22cafe%22%7D%2C%7B%22key%22%3A%22address%22%2C%22constraint_type%22%3A%22geographic_search%22%2C%22value%22%3A%7B%22range%22%3A10%2C%22origin_address%22%3A%22New%20York%22%7D%7D%5D&sort_field=name

However, how could I access a specific value of that specific type via URL? For example, the value of the email address of the User database.

And 2nd question: Is it possible to add an API token via URL instead of using the API Bearer Token (I’m using it when setting up a call that is not via URL) to access tables with privacy rules?

Thanks a lot!

The get API you are using, doesn’t have a parameter to configure a subset of fields to return. Perhaps you can limit which fields by altering the privacy rules?

Another option is to have your own API Workflow endpoint, retrieve the parameters and return specific fields.

This is a bad idea for security, GET query parameters aren’t in a secure part of the query. I’m fairly sure the Get Data API can’t be setup that way, although the API Workflow endpoint can.

What does this mean?

Hi @mishav! Thanks for the help! :slight_smile: So:

This looks interesting. However, how can I custom make a response to be sent back when an API Workflow is called from outside? Something as sending back a response in a JSON way when an API workflow is triggered via a GET call. This, actually, would solve EVERYTHING. However, I haven’t found a way to do it so far… Any ideas? :smiley:

Good point, let’s avoid that, then!

Thanks a lot for the help!

Oh yeah, API workflow is only for POST. Any particular reason you need a GET call?

@mishav no, no, I can try to turn things into a GET. The thing is I don’t know how to send back a response from an API Workflow called externally (so, personalising the response, apart from a simple 200 message). Is it possible actually? :slight_smile: Thanks!

Add workflow step > Data > return data from API

You can choose to return whatever text you want, or build up a JSON object.
:smiley:

1 Like

OMG @mishav, more than 1 year using Bubble and until now I didn’t see this!!! You don’t imagine the amount of crazy workarounds I’ve been doing to have an equivalent to that simple thing… Impressive! Thanks a lot, you made my day! :smiley:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.