Create new / save to database using API call?

Hi all. I am trying to create an API call that gathers data from an input field that the user fills out. The aim is to save multiple photo uploads to the database through an API which allows the user to go to their dashboard while the photos are saved in the database in the background.

At the moment, I have an onclick button workflow structure that creates a new gallery. After this, the workflow returns the user to their dashboard. The problem is, that because the workflow is still creating the gallery (which takes a long time), nothing happens until the photos are saved to the database.

I am familiar with how to create an API call by changing existing data in my database. But how do I create something new by using data from an input field on another page that is not saved to my database? for example, the user uses the multiple file upload function and when a button is clicked, it triggers an API call to create a new gallery by saving the multiple file upload contents to the database.

My existing method is really, really slow, and the user has to wait a good couple of minutes after creating the gallery before they can go back to their dashboard. I can only seem to fetch data from an API that has already been saved. I want to save data from input fields through an API from a specific page.

What I hope to achieve:

  • user uploads multiple photos
  • user presses the ‘save’ button
  • API creates a new photo gallery (images = multi file upload values)
  • user is returned to dashboard while API is still running
  • popup occurs “your gallery is being created, check back soon”

At the moment this is what happens:

  • user uploads multiple photos
  • user presses the ‘save’ button
  • user has to stay on the page for several minutes while photos are being saved
  • user can only return to dashboard after photos are saved

It’s okay I figured out how to do it, I created the same fields as what I want to create, in the User type group, so when the API is triggered, I can pull the data from the user fields. Unless there is another way? feedback welcome.

Are you on paid plan? If so you can set up a loop backend WF to create the images in the background and the user will be free to navigate to other pages while the gallery is being created.

Yes, I am on a paid plan. The problem is, to create a new “thing” in the database through an API, I need to save the files to the User before triggering the API. This is because the API can only create something new from data that has already been saved. It cannot pull data from a state or an input field. If you know anyway around having to save the data to the user field before triggering the API, I would love to hear your ideas.

Why. You could pass the URLs as a list in the BE workflow can’t you? Along with the users unique ID allowing you to associate images with a user.

Let’s try to make it happen.

  1. Create a data type “Gallery” with the fields shown. The field “Image_number” is just in case you want to number the images. You can also create a field called “API done” as a yes/no type. So the API afterwards will only get “no” values. When the image in this gallery is created setup default as “no”. When the API runs change it to “yes”.

  1. Crete a new Backend WF.

  1. Go to design page with the uploader and create this WF for the Save Button.

4)Go back to Backend and create this step.

5)BE CAREFUL: this steps should work but check in the Log page if it’s creating data non-stop in a loop. It shouldn’t! But just in case. If it does create a non-stop data pause all scheduled WF and delete ONLY the respective WF.
In this case we will need to create one more thing to work without non-stop loop.

Please let me know if these steps worked.

Good luck!

wow thanks! I will give that a go :slight_smile: