I have limited knowledge on the web component so can anyone please help me to implement TinyPng API in my app.
https://tinypng.com/developers/reference
I had been using these blocks but this does not work :
I have limited knowledge on the web component so can anyone please help me to implement TinyPng API in my app.
https://tinypng.com/developers/reference
I had been using these blocks but this does not work :
Check your Headers:
Also use the POST method together with the image
Taifun
Based on the suggetions of @Ded_Sec_00 and @Taifun I have made some changes but it still doesnt work.
In the API reference of TinyPNG :
Delete the space and : in your Headers. Look at my pinned Post.
I think the /shrink has to be on the end of the API URL in the Web URL and you have to use Put File.
I have tried but it doesnt work.
Thanks anyway.
The post data contains the image binary ie multipart//form data . So ,
It can be solved by sending binary data from the extension. Can you send me the api documentation ?
Yeah, here i found a specific API from Tinify. However, I don’t feel that api is made for android too as it is reported to crashing on device with
~~main java.lang.NoClassDefFoundError: java.nio.file.Paths~~
As android doesn’t supports java 7 fully and java.nio.file.Paths is added on java 7.
Since, its open-source , i will modify library and update result here !
also you have to set the url property, which is https://api.tinify.com/shrink
and: first set the url and the header, then use the Post method together with the image
also remove the Get method…
and in the Web.GotText event display the response content in a label…
you might want to try this and if you get stuck, post a screenshot of your updated relevant blocks
Taifun
PS: no need to use an extension…
this looks almost fine…
Basic
in front of your authorization key?Basic nR...
Host
header…Taifun
which response content do you get in the Web.GotText event?
did you try this
you also might want to use Do it to find out the path of Image1.Picture… is it suitable to use for the Web.Post method?
use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun