How do I convert cURL syntax to thunkable?

Hi everyone, I’ve been working on a school project that involves using DeepAI’s deep dream API. I want my app to take a photo that the user uploads and sends it to the API, and returns the image processed by it. I’ve been having a bit of trouble getting the syntax formatted properly, and it’s been causing me a lot of trouble.



This is how the documentation describes using the API, and I’ve been trying to the best of my ability to make it work in thunkable. I’ve set the my webAPI URL to https://api.deepai.org/api/deepdream, and have created a header called “Api-key” set to my API key. Yet, I’m still evidently missing something and it’s been causing me trouble. Online cURL converters have helped me somewhat, but I’m still stuck.

For reference, here’s a link to the DeepAI deep dream documentation

Thank you in advance!

1 Like

This is really helpful information that you provided. I haven’t worked with the -F flag for API calls. It’s apparently form data as explained a bit here and here. I just tried to Post the data several different ways (as header, as body, as query parameter; with and without a leading “@” symbol for the image path) and each time it returned the error “error processing given inputs from request.”

So I’m not sure and I know that’s not very helpful but I’ll let you know if I get it working. Here’s the curl command that works in Terminal on a Mac:

curl \
    -F 'image=https://www.birdlife.org/wp-content/uploads/2021/06/Owl-in-tree-by-Philip-Brown-1-1024x576.jpg' \
    -H 'api-key:quickstart-QUdJIGlzIGNvbWluZy4uLi4K' \
    https://api.deepai.org/api/deepdream
1 Like

can you try this? (i can’t test it)

1 Like

I’ve run out of free calls with the quickstart API key I used above. But I’m sure I tried that combination and got the same error. I also can’t get this to work at all in Postman. Only in Terminal.

1 Like

i didnt know you can get a quickstart apikey. i’ll try later. thanks

1 Like

It’s just the one displayed in the documentation so I think it’s something anyone can use. I didn’t have to generate it in any way… just copied and pasted. But it only allowed maybe 5 calls.

1 Like

i got postman to work (the -F part became part of form-data).

here’s the result:

i never got to translate the -F part to thunkable before the api-key ran out!.

3 Likes

For the F parameter to work, you need to include in the header:
Content-Type=x-www-form-urlencoded

This option tells the API to treat the properties as if coming out of HTML form.

2 Likes

i think the api-key has no limit - i’ve used it in and out of postman several times for 2 days and i get 200 return codes (see below) for the same reason i think the same api-key should also work in thunkable.

but i can’t seem to make thunkable to do this. i’ve tried your suggestion, and other settings.

can you (@muneer or anyone else) try to make my project (see below) work? thanks.

here’s my postman screenshots


and the link to the output:
https://api.deepai.org/job-view-file/12f7bfa3-b333-4d2b-97af-8fba69ba07ef/outputs/output.jpg

here’s my block:

here’s the project link
https://x.thunkable.com/copy/915ab7ab40e21ed88eaa403e4e0870a1

2 Likes

The easiest way I have found is what you are doing here ^^^ @manyone

Nice!

did it work for you? it doesnt work for me! maybe the api-key does have an expiration count as @tatiang suspects.

@manyone
@tatiang
@Jared_Gibb
@s114895u5j68v

Here is a working copy of @manyone project

https://x.thunkable.com/copy/d7bd72114656eb551fa71b2516d80684

3 Likes

thanks!
that’s tricky! you’d think it follows the same “standard” json method of key:value pair but it doesn’t!

1 Like

image=

Aha! I almost tried that but wasn’t sure where to put it.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.