Problem implementing web API (Stablediffusionapi)

Hello!
I’m trying to get (Stablediffusionapi) to work using the Web API Feature but had no success…
This is a photo of the blocks I’m using

  • I’ve tried different blocks in the Header including ( Accept - engine-ID … etc )
  • I’ve also tried different endpoints but have had no success
  • everything is working as it should in Postman so i have no problem with my API whatsoever

I’m getting an error (NetworkError when attempting to fetch resource.) when trying to test the App on the web so I have exported the APP as APK but i got no error message when trying ( no response)

Does anyone know where could the problem be ?
Thanks in advance :slight_smile:

if the call was ok (status=200), then the returned picture is from property “output” (see sample from response from Text To Image - Stable Diffusion API)

Thanks for your reply!
So you mean i have an error in the last block?
I have created an if-do block and said if the status = 200 then show the result like this
But how can i add (output)
Should I write it in the text block?

Use ‘output’ as property name

i did that but didn’t work also :frowning:

Can you try “output[1]” as the property. The returned object in ouput is an array.

Nothing happens,
I don’t get any error message or any result and the dashboard in stablediffusionapi didn’t register any Response or request
and I’m pretty sure of everything including the API and url
so frustrating…

i got it to work - here’s my output.

i was down to 7 remaining calls when i got it to work (20 free calls per month).
here are the blocks:


(i was using textinput2- field at bottom - for debugging)

and here’s the project (you have to provide an apikey)
https://x.thunkable.com/copy/d016811384ade549eb4cb61154380a75

3 Likes

i know why it’s not working for you. you’re inside the if_error block when you’re testing the status. if your call was successful, you’d never get inside your if_error block.

1 Like

Thanks for your help!!
The error was actually because how I have the body, I had samples then negative prompt then height so when I tried your project I used the same textinput2- field at the bottom - for debugging and I got an error saying the height must be a number and sample must be a number so I knew I had something wrong in the body
Thanks again for the fantastic help <3

glad to help!

1 Like

Is it possible to let the user download the result image or not ?

Can you try the “outdir” paramter, use a value of “,” (dot) and see if ut saves it to Downloads. Otherwise you’ll have to do s creen capture, or send a query to stability ai.

thanks for replying!
After some work I found a way to do it and it worked :heart_eyes:

Are you going to share it?

Yes sure,
I’ve set the result to an App variable called result then used the resize image block when the user clicks on Download and I’ve used the upload file block with an open link block as well ( URL) so when the user clicks on download it uploads the result to URL and opens a link with the photo ready to download

1 Like

thanks for sharing!

1 Like

Another question if you don’t mind :slight_smile:
is there anything wrong with my If-do block?
because it navigates to download page even if status is not 200
I tried response and tried if not error also

The status block returns a text string. So you need to compare it to “200”. I usually just check for an error and don’t worry about the status but I’d try that if you need to check it.

i tried that as well, if not error and if stats = text string (200) and in both cases it didn’t work