Work with values received from an API call and create a thing if it not already exists

I want to do an API call which returns a JSON structure. this already works.
However, in the workflow it seems it does a new API call for each field in the JSON I want to store in a thing.

Is it possible to make the call, store everything in some sort of variable and access it later in the workflow?

I want to create a thing and assign several values from my API call to the datafields of the thing.
I also only want to create the thing, if it doesn’t already exist. There is a field for an ExternalID that I use to identify the external record.

Can someone help me with that?
I’m really new to Bubble and I’m a bit lost right now.

Hi!
you can do this by setting a state for an element. Let’s say you have a Group (any other element works as well) where you need the JSON data. In your workflow you need to set a state for that Group and assign the output of your API call as the value of the state. Like this you will be able to access the data without saving them in the database.

2 Likes

This is not good as states expose the output in an unencrypted way and ignores all privacy rules in place.

Instead make a POST call to your endpoint.

That’s a good point, I guess you can encrypt them from the backend side, assuming it’s important.

How do you make this POST call and how can you access the data without saving them in the database?

I’m not sure about that process. Haven’t had a use case for it yet.

You can make a plugin or use the API Connector to make these POST calls.

I came across the below information which might be useful. Rendering Client-side JavaScript to connect to the database with codehooks.