# API connector and workflows

**URL:** <https://forum.bubble.io/t/api-connector-and-workflows/199258>\
**Category:** APIs\
**Created:** [March 29, 2022, 9:06am UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258 "2022-03-29T09:06:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![servanedepompignan](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@servanedepompignan](https://forum.bubble.io/u/servanedepompignan)\
**Post date:** [March 29, 2022, 9:06am UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258/1 "2022-03-29T09:06:42Z")

</div>

Hello, I am using the Bubble Api connector plugin to connect to an external service which removes the background from my pictures and returns a picture with no background as shown below :

 ![cap1](https://us1.discourse-cdn.com/bubble/original/3X/b/9/b9f926a66372e3435e5edb8204caeb492211fa68.png)

The problem here is that the API returns a picture and does it everytime I refresh my page so the same image is stored multiple times in “Files” I want to find a way to prevent this if you can help thank you 🙂

 ![cap2](https://us1.discourse-cdn.com/bubble/original/3X/8/0/80dbcd80b749b27940bddf486d38d992f7115ebe.png)

---

<div class="post-metadata">

**Author:** ![machadoa953](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/machadoa953/32/201276_2.png) [@machadoa953](https://forum.bubble.io/u/machadoa953)\
**Post date:** [March 29, 2022, 11:22am UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258/2 "2022-03-29T11:22:53Z")

</div>

Hello, I noticed that duplicate recorded items have the same id, have you ever thought about restricting when saving, to check if that id already exists and not save the same id?

---

<div class="post-metadata">

**Author:** ![servanedepompignan](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@servanedepompignan](https://forum.bubble.io/u/servanedepompignan)\
**Post date:** [March 29, 2022, 1:35pm UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258/3 "2022-03-29T13:35:10Z")

</div>

Hello, thank you for your response but I don’t think that will solve my problem as there will be multiple users that can call the API . I will still have duplicates with different User Id.

---

<div class="post-metadata">

**Author:** ![mattblake](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mattblake/32/149474_2.png) [@mattblake](https://forum.bubble.io/u/mattblake)\
**Post date:** [March 29, 2022, 3:44pm UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258/4 "2022-03-29T15:44:34Z")

</div>

Can you post an example of the API response or the API provider you are using? Usually the response will include a unique ID (separate from anything in your Bubble database) to help prevent exactly what you’re encountering here.

---

<div class="post-metadata">

**Author:** ![christo1](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@christo1](https://forum.bubble.io/u/christo1)\
**Post date:** [March 29, 2022, 8:56pm UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258/5 "2022-03-29T20:56:16Z")

</div>

It looks like the image itself triggers the API call, so each time the page is refreshed the API call is triggered as expected with this setup. Maybe tag the images in the database (filename ; processed = yes) to mark if they have been through the API and then conditionally change the image to either show the API version or the already processed version. Or am I completely missing the point here?

---

<div class="post-metadata">

**Author:** ![nnich19](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/nnich19/32/18315_2.png) [@nnich19](https://forum.bubble.io/u/nnich19)\
**Post date:** [March 29, 2022, 9:05pm UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258/6 "2022-03-29T21:05:43Z")

</div>

Why not just process the images when uploaded, then save them to whatever datatype you’d like? That way, rather than processing it with the API on every page load, you just make the data source the pre-processed image.

---

<div class="post-metadata">

**Author:** ![servanedepompignan](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@servanedepompignan](https://forum.bubble.io/u/servanedepompignan)\
**Post date:** [March 30, 2022, 8:51am UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258/7 "2022-03-30T08:51:15Z")

</div>

Thank you for your response but I can’t do that because the images may change over time, they are stored in the database and only the 3 last records are shown on my element

---

<div class="post-metadata">

**Author:** ![servanedepompignan](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@servanedepompignan](https://forum.bubble.io/u/servanedepompignan)\
**Post date:** [March 30, 2022, 8:54am UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258/8 "2022-03-30T08:54:01Z")

</div>

I have thought of that but the images can change, they are stored in the database but only the 3 last records are processed via the API

---

<div class="post-metadata">

**Author:** ![servanedepompignan](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@servanedepompignan](https://forum.bubble.io/u/servanedepompignan)\
**Post date:** [March 30, 2022, 8:55am UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258/9 "2022-03-30T08:55:31Z")

</div>

Thank you but the API I am using is not free so I am trying to process the least amount of images I can (only the 3 last records are processed and shown on my element)

---

<div class="post-metadata">

**Author:** ![servanedepompignan](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@servanedepompignan](https://forum.bubble.io/u/servanedepompignan)\
**Post date:** [March 30, 2022, 9:01am UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258/10 "2022-03-30T09:01:15Z")

</div>

Here is a response example :

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/f/3/f377014a2f9bd1fe40d5c3e06635fcac1647b66a.png)

you can find it here : [https://www.remove.bg/fr/api#api-reference](https://www.remove.bg/fr/api#api-reference)

---

<div class="post-metadata">

**Author:** ![mattblake](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mattblake/32/149474_2.png) [@mattblake](https://forum.bubble.io/u/mattblake)\
**Post date:** [March 30, 2022, 9:33am UTC](https://forum.bubble.io/t/api-connector-and-workflows/199258/11 "2022-03-30T09:33:30Z")

</div>

Hmm how frustrating there doesn’t appear to be a uniqueid.

How about this? If you can rename the file to make the file name unique will that solve your issue [How to rename files when saved to S3 - #3 by bartek.dev](http://forum.bubble.io/t/how-to-rename-files-when-saved-to-s3/159265/3)
