Create multiple things after an API call

I’ve defined an API call that returns a JSON file that contains an object that contains multiple records. A sample JSON is below.

I know how (thanks to @Jici ) to run on API call that returns a JSON file which I then use to create ONE thing. I now need to do something similar but where I create MULTIPLE things.

In the example below, the thing I want to create is EmailAddresses, with a field structure based on the contents of the JSON below.

In the sample JSON below (which was obtained by looking at the raw data after I verified the API call works), see that the “emails” key has 10 email objects within it. I need to create one EmailAddresses thing for each of the 10 (in other API calls it could be as few as 1 or as many as 100) email objects within the JSON file. I also am discarding the “sources” object within the “emails” object, so I just need the other stuff.

My question is, does anyone know how to do this?

===== Sample JSON below
Unfortunately, it was too long, so it’s included by reference.

You need to run a workflow on a list of thing. You can set the type of list of thing to be of type text. The list of text will be the list of email value
You will create a backend workflow that will contain the reference to link the email to the correct thing (probably a text field) and another field that will contain email (This email). You will create a new thing that will contain the email and link to the correct thing (probably using search for…).

I hope that you will understand how to do that.

Unfortunately, I don’t. I’m still new to Bubble. Would you mind breaking it down into smaller pieces for me.

In a Workflow, under Data (Things) I see, “Make changes to a list of things…”, “Delete a list of things…”, “Copy a list of things…”, but I’m not seeing how to use those to create a list of things. Also, when I try to use “Make changes to a list of things…” it’s not clear to me what I put in the “List to change” field. I’m also not sure if that’s the best way to proceed, or if you’re steering me to a different solution.

I’m not even sure what is meant by the phrase “type of list of things”. I don’t see where Things have types. I do see where fields have types.

You cannot Create a list of thing. So you need to Schedule an API Workflow on a List of thing.
The API workflow (now Called Backend Workflow) need to be activated in the Setting API sections.

You’ve given me a starting point. I have a feeling I’ll be in touch soon. Thank you.

1 Like

Hi, @kevin4 were you able to get this to work? And could you share details how you moved a list to a “thing”?

I did get it to work.

But with creating records for email addresses, I had a need to do that differently, so I’ll show you how I used the advise given to create a series of records from a list of things, in this case, records that contain URLs and information about the URL.

In my case, I wrote a custom plugin that returns an array of URLs, and each URL then becomes on record, but the list could be anything. In my case it happens to be an array of URLs returned by a custom plugin.

Here is a picture of the workflow:

And here is the invocation of step 6:

What matters here is the Type of things is “text” because the list being fed into this action is a list of texts. In my case, the list to run on is the array of URLs returned by the plugin, but again, it could be any list.

The fields provided are defined in the API workflow, as shown below:

I hope this helps.

2 Likes

@kevin4 that worked perfectly! Thank you so much for the help.

Glad to hear it.

Without this forum, I would spend more time aimlessly flailing.

1 Like