Using imgBB api in livecode (solved)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 39
- Joined: Thu Jan 23, 2020 5:56 pm
Using imgBB api in livecode (solved)
Hi,
I tried to use the imgBB api in livecode, but it didn't worked well for me.
https://api.imgbb.com/
Do you know how can i use it in my program?
I have the basic free livecode edition if that matters
Thank you
I tried to use the imgBB api in livecode, but it didn't worked well for me.
https://api.imgbb.com/
Do you know how can i use it in my program?
I have the basic free livecode edition if that matters
Thank you
Last edited by BigameOver on Sun Sep 27, 2020 1:21 pm, edited 2 times in total.
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Using bbimg api in livecode
LC supports sockets, and provides a library using sockets for HTTP. You can start with the GET and POST commands in the Dictionary, and chime back in if there's anything in the API that's not clear on how to call it from LC.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 39
- Joined: Thu Jan 23, 2020 5:56 pm
Re: Using bbimg api in livecode
Hi FourthWorld,
I tried to do this code but when i run it livecode crashes:
What can I do?
Thanks
I tried to do this code but when i run it livecode crashes:
Code: Select all
on mouseUp
put base64Encode(image "my_image") into _tImage
request POST "https://api.imgbb.com/1/upload?key=YOUR_CLIENT_API_KEY?image=" & _tImage
end mouseUp
Thanks
Re: Using bbimg api in livecode
The dictionary is really helpful with these things!
This should do:
Code: Select all
on mouseUp
put base64Encode(image "my_image") into _tImage
POST _timage to URL "https://api.imgbb.com/1/upload?key=YOUR_CLIENT_API_KEY?image="
end mouseUp
-
- Posts: 39
- Joined: Thu Jan 23, 2020 5:56 pm
Re: Using bbimg api in livecode
Hi Klaus,
Unfortunaly, It doesn't work for me
When I answer it it says ""status_code":400,"error":{"message":"Invalid API v1 key.","code":100,"context":"Exception"},"status_txt":"Bad Request"
Unfortunaly, It doesn't work for me
When I answer it it says ""status_code":400,"error":{"message":"Invalid API v1 key.","code":100,"context":"Exception"},"status_txt":"Bad Request"
Re: Using bbimg api in livecode
If your api key is correct, what the error tries to tell you, try this:
Code: Select all
on mouseUp
put "image=" & base64Encode(image "my_image") into _tImage
POST _timage to URL "https://api.imgbb.com/1/upload?key=YOUR_CLIENT_API_KEY?"
end mouseUp
-
- Posts: 39
- Joined: Thu Jan 23, 2020 5:56 pm
Re: Using bbimg api in livecode
My api key is correct but now it says this:Klaus wrote: ↑Sat Sep 26, 2020 8:14 amIf your api key is correct, what the error tries to tell you, try this:Code: Select all
on mouseUp put "image=" & base64Encode(image "my_image") into _tImage POST _timage to URL "https://api.imgbb.com/1/upload?key=YOUR_CLIENT_API_KEY?" end mouseUp
{"status_code":400,"error":{"message":"Invalid base64 string.","code":120,"context":"Exception"},"status_txt":"Bad Request"}
How can I fix this?
Re: Using bbimg api in livecode
Sorry, out of ideas...
-
- Posts: 39
- Joined: Thu Jan 23, 2020 5:56 pm
Re: Using bbimg api in livecode
Does anybody else know?
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Using bbimg api in livecode
What headers are required by the API? And have you successfully authenticated?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 39
- Joined: Thu Jan 23, 2020 5:56 pm
Re: Using bbimg api in livecode
The key and the image are required by the API. I got my key from the site and just copied it.FourthWorld wrote: ↑Sat Sep 26, 2020 7:54 pmWhat headers are required by the API? And have you successfully authenticated?
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Using bbimg api in livecode
Have you been able to use those successfully in Postman or other tool outside of LC?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 39
- Joined: Thu Jan 23, 2020 5:56 pm
Re: Using imgbb api in livecode
I haven't heard of postman as it is my first time trying to use an API in livecode but searching this on google with imgbb leading to zero resultFourthWorld wrote: ↑Sat Sep 26, 2020 8:09 pmHave you been able to use those successfully in Postman or other tool outside of LC?
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Using imgBB api in livecode
Postman is a very popular tool for testing HTTP-based APIs.
https://www.postman.com/
https://www.postman.com/
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 39
- Joined: Thu Jan 23, 2020 5:56 pm
Re: Using imgBB api in livecode
Hi,FourthWorld wrote: ↑Sat Sep 26, 2020 8:59 pmPostman is a very popular tool for testing HTTP-based APIs.
https://www.postman.com/
I tried to use the API in Postman with the example on the imgBB's site but it only says in the status: 404 Not Found
What I don't do right?