How to return JSON objects in a plugin server-side action

Hi all,

Can anyone help me figure out the best way to return a JSON object from a plugin server-side action? I currently do an HTTP GET request that returns a list of JSON objects with varying keys and values.

I’d like multiple JSON objects and their keys and values to be selectable in the workflow action results the same as when you do an API Call action.

The best solution I’ve found is this post, however, it seems convoluted having multiple workflow steps and a separate App Type input field just to output the object.

I have reached out to Bubble Support but they were unable to help and recommended I post on the forum.

If you have any insight please share.

Thanks,

Phill

Why dont you use API connector to do the get request?

I can’t unfortunately, I need to do the request in an SSA.

The only solution is to create the faux API call to define the API object. Once you define the API object, you can then use it within your plugin. If this is a plugin just for your application that can work, it’s not a great solution if you plan to distribute it as everyone of your users would have to manually define the API in their application.

This is in my opinion (and others) one of the most limiting factors of Bubble extensibility and it doesn’t appear to be on the roadmap to be fixed anytime soon.

The long discussion and example on this post:

2 Likes

I continue whit the same question. Why a ssa? API connector perform call server side (except if you select perform on client side if possible). My opinion is to instead of creating complex process like the fake API and transform the payload to fit in the API result expected by Bubble, its easier yo use API connector directly. In some case, you might think you cannot use it, but honestly, I have created a lot of API connection and only one really needed to be created in full using SSA. So if you can explain more your use case, we can probably provide you with a better solutions. But if you really want to continue that way, the post mentionned are the only way yo do that

Hello @Jici , I’m for days trying to solve one problem with an API call.
When saw this post I thought you could give me some hints, if possible, I would really appreciate it.

I’m not being able to retrieve some data from an API call with the API connector.

When I initialize the call, Bubble seems to not understand some of the values and returns them empty when called in the front end.

The data appears when I click to “see raw data” in the inicialezed call though.

I made a post here in the forum explaining it in detail. If you could give me some hints on this one, I appreciate it.
Here: API Data not showing - API Woocommerce + Booking

Some other Bubblers advised me to transform the data before loading it to Bubble or transform it in Bubble with a server-side plugin.
But as a non-technical person, it is beyond my knowledge

Hey Celso BR friend!

I was experiencing something similiar earlier today and bumped to this old thread.

This first video helped me a lot: How to return objects from plugins (SSA, CSA, Element Update & Element Workflow Actions)

I’ll try to summarize the steps, but they are a bit confuse and I won’t spend much time on it since I don’t know if you are still in this project.

Plugin:

  1. Define the data type that you want to return. To achieve this, create a dummy API call and define the response manually with the datatype that I want to return from my function.
  2. Use this data type at the plugin Action: Create an Action. You will need to receive this data type from your App (“New Field” > “Editor = App Type”).
  3. Your Action will return in this data type: (“Returned values” > “New key” > “Key Type = as [key_created_step_2]”)
  4. The action code will return the format of the object defined at step 1.

At your App:

  1. Your app will receive from plugin the data type defined at step 1.
  2. You will pass this data type to your plugin workflow (Action).
  3. Your plugin will return this data type.

Let me know if you need any help, I would be more than happy to help you for free (it is always good to expand the network, hahaha).

Best Regards,

2 Likes