API returns a list within a returned set of data

I’ve hit an obstacle I need help with.

I’m making an API call to an email address retrieving service named Hunter.io.

It returns a JSON object which contains a sub JSON object.

Within the Bubble API returned value viewer, it looks like this:

My goal is to create one instance of record type A for each returned value and then, using a backend workflow, to create one instance of record type B for each returned email address>

I’ve created record types A and B.

My thought is to save the list of email addresses in a list field in record type A.

Then invoke a backend workflow where I hand that list to a recursive workflow.

The obstacle is I can not see how to save the list of email address objects within record type A.

That looks like this:

Has anyone encountered this before, and if so, how did you solve it?

You just miss one “more” thing in your value: value (click on more, select value) (this is a guess that your Email Addresses field is set to a “Text” type)

In this record, Email Addresses is a list of DB records. I can’t have it be a list of Text as multiple fields are returned and I need to capture all of them.

What do you need to capture? The email address or all the payload Emails (List) or the API that include the type and everything else?
If this is what you need to capture, You will need to Schedule API on a list, using the Type of thing of the API List. But you can also store directly this part of the payload into DB by creating a field of type of the thing of the API List. This is available in both case.

I need some of the meta data from the returned object.

I then need most of the data from every instance of the payload Emails (List).

I’m thinking maybe there is someway I can not create a record for the returned objects meta data, but rather pass the needed meta data into a backend workflow which creates the “Payload Emails (List)” records, where the meta data will be duplicated for every record.

I hate to duplicate it dozens of times, but it’s really small, so that’s a workable solution, if I can figure out how to do it.

The main thing is that actually, you are using an wction but should use data for the api call. Doing this will allow more possibilities with DB and backend workflow like I told you

I still have this same problem, of having to create multiple DB fields from one API call.

I’m not sure how to do that when the API call is Data and not Action.

How do I?

You will call the api in the Make a change or Create a thing action directly. Not before this action. Or, you use “Set state”. In the set state, you will use the Get data from api. In the make change to a thing or create a thing, you will use state data. You should use state if you have more than 1 fields to populate.

Should this work if one API call returns 100 “sub-objects” within the main object?

It’s not clear to me how I would create the 100 sub-objects within the one Create a thing action.

This won’t change anything between action or data. If the api return too much data, this may cause a timed out issue.

It’s hard for me to help me because I don’t know exactly how you want to use this data and what you want to do.

What I understand is that you want to split the email list returned by api (with all related data like type, confidence…) into unique item in a DB.

For that you need to schedule API Workflow on a list. And to be able to do that, you need to put the API call to “Data”. So this will be available in Type of thing and in Get Data From API.

I’ve created a Data workflow that returns the same JSON object, and I’m now back to the original issue of long long ago when I wanted to get every bit of data from the API with a single API call.

I am not seeing how to do that when I use the Data API call.

I understand I need to Schedule API Workflow on a list. What I’m having trouble with is creating the list.

I can easily create a Thing that contains all fields EXCEPT the “emails (list)” (and for this I refer you to the top image in my initial post).

What I’m not having success with so far, is creating a list of the “emails (list)” sub-object that is returned by the API call.

Can you share your Schedule Workflow API on a list setting?

In an effort to start with a clean slate, I deleted the actions from the workflow using the “Action” API data and decided to start over with the “Data” API data.

So unfortunately no. I just deleted it.

I’ll try to build a workflow using the “Data” API call, see how it goes, and comment here if I’m still confused.

When you create DATA type in API call,
All type and subtype of the call will be availabe in the Type of Thing list.
So you wil lbe able to choose the Type of thing of the API call that will probably be
Email Addresses 's emails
You select this. In data source, you do: Get Data from API, and call this api endpoint and take time to select 'emails
So both Type and Source will match,

Now once it’s done, you can add field into your Backend workflow. Like email, type and confidence. (text, text and number),
And in the Schedule API on a list, you will field email: this email’ value. type: This email’s type, confidence = This email’s confidence.

I’m already confused. By virtue of “falling back” on using an API Data call, I’m back to my very original problem is having to make one API call for each DB field, which is a waste of API calls.

About that: API call for each DB field Answer is not when you use state or store the data into a DB field (because you can set a DB field to be of the type of the API Call data, list for scheduled workflow on a list or a RG)

Can you please elaborate on:

because you can set a DB field to be of the type of the API Call data, list for scheduled workflow on a list or a RG

I do set my DB fields where I have one field per piece of data returned by the API call.

I do want to set the returned JSON sub-object to a list, but what is it a list of? It can’t be a list of a DB field that has been created to mirror it, because the DB fields are not yet populated with data, because that is the step I’m trying to take.

So what exactly is it a list of?

I’ve put the picture of the API call returned data below for quick reference.

This is what I mean for the scheduled Workflow on a list. Get Email By Domain d… Is a data type from the API Connector. Not something in my own DB. (I called the API Call Get Email By Domain. and this return the same thing that you have in your screenshot. I select the “Emails (list)” that you have in your screenshot because this is the list I target).
the list to run on if the API Call. Using Get Data from api. And selection the “Emails” that is a list

1 Like

You can do the same thing in the DB itself. You can create a field, and select for type, the Data type from the API Connector.

With your last comment, I think you set me straight. I had no idea I could define a DB field to be a List of data returned from an API call.

I just did that, and the syntax is legal.

I’ll test it in the morning.

1 Like