Response from API workflow returning empty field

Hi,

I need assistance on using an API in a workflow.

I am trying to build an AI generator webapp where a user uploads an image, inputs a prompt, submits the information through the API, and a GET call should return a URL where the AI image should be.

I’ve been able to initialize my API and receive the expected result In the API connector but not in a workflow.

My problem is when I put it into my workflow, my API is returning an empty process_id. I’m not sure where the issue is exactly. I’ve included some screenshots and a brief description of my set up.

API Set up.
I’ve got a POST and GET call successfully initialized. In the POST response, I need the “process_id’s” value to be able to locate the generated image from the GET call. The generated image is in the GET response as a URL “output”

POST response:

GET response:

The workflow

Debugger

But the process_id returned is empty

I’m thinking it might be possible that the image generation status is still in progress while the workflow executes thus giving me empty values. However, I don’t know how to test this or fix it. I’m not sure if setting up a webhook is my fix, or if I need to adjust my workflow. Any help is appreciated! Please let me know if you need more information to help me through this hurdle.

Hey, when you call the API, you should also add a webhook url, which is a backend api workflow for within you bubble.io app

when the result of image is ready , the monsterapi.ai will ping your bubble.io app and send the image to it,

you can also use status url to check the status of you request but it depend on the api you request may take few second to get ready … thats why its better to give it a webhook so when it ready it will ping your app.

jsut create the webhook with initialized one time and then remove the initilization from its url.

Hey @jessicarcarmichael

@Baloshi69 is right

As you can see in the debugger, the conditional is red, means the step 1 is not completed.

In frontend, steps are trigered as soon as possible. So the GET will not wait for the POST to be processed.

Maybe what you can do is using a custom event on you page or reusable to process the POST api call, and use the result in it a RETURN DATA and then in the initial workflow use the result of the custom event as a condition to run the GET conditionaly (custom event are a way to really process steps in the order you need in frontend)

1 Like

Would it be possible to show a visual of how you set this up? I am having the same issue with some APIs as well.

Thanks.

@Sarah_Esteve Thank you so much for taking the time to do this, very helpful of you.

Kind regards,
K

1 Like

Thank you @Baloshi69, I’ve tried setting up a webhook but the api service Im using is having an issue with the initilization and I’m waiting for them to finish their investigation on the issue. So, right now I cannot set up a webhook.

Thank you @Sarah_Esteve for your detailed response, I’ve currently been trying to do what you’ve suggested but I still have an issue with the API workflow. You feedback was that the POST was unsuccessful (step 1) but I think that is just a condition that I was in the progress of setting up. When I look more closely at step one, the payload says it was successful but when i investigate my empty field, I get this response that says " Data with ID “undefined” from an API" in the field which I am expecting a process_id to use for step two - does anyone know what this means?

The initilizationis from bubble end its not from your API provide.

when you be free ping me here or linkedin i will walk you through it.

1 Like

Hi @Baloshi69 ,

I’m stuck with a problem like this, my workflow return data and I can’t access to this Id, return undefined… have you a solution ?

@jordan.rmnpro can you explain you situation in details , or ping me on linkedin let chat

@Baloshi69 of course,

I use an api as data for return a custum data trigger by get.
The result return by the call is an array. I share a screenshot of the return.

The response is ok and can use as data. But, when I want to access the id is always undefined.

Hope is clear for you!

Look forward for ur feedback!