in my app, i was tooling with a system to get a qr code from an api.
issue is, setting the set image 1 to block seems to just crash or bug out whenever i try to set it as the response from the api. As far as i know, its not being returned in json format or anything like that. any ideas?
i tried using the qr and setting it as the value on the set cell block, but no dice, airtable returns an “invalid attachment” response. didn’t know if anyone had tried this before
First I would recommend you find out what is in the response. the easiest way is to send the unaltered response to a label or text_input. Is it sending HTML? URL? JSON? It would surprise me if it were sending the actual image.
Could you show your blocks and the results of this test?
The sample url http://api.qrserver.com/v1/create-qr-code/?data=HelloWorld!&size=100x100 returns a QR code but not in a formatted way (e.g. JSON). So I don’t think you can use that API with Thunkable. There’s not a way to “grab” the image… you really need a text response, ideally JSON, where you can parse out the filename that ends in .png.
The documentation does indicate that you can specify the output format as JSON when reading a QR code but it doesn’t seem to offer that option when creating a QR code. A quick Google search did not turn up any QR code generator APIs that return JSON. Well, I did find one (Mussa Studios listed on this page) but it was not secure so I didn’t look at it.
Thunkable doesn’t do a ton of error checking when placing blocks in the editor. It does some.
One option would be to simply create the url you want for the API and then use a web viewer to display the QR code in Thunkable. It’s a little messy, perhaps, but it could work.
So you’re wanting to store the image of the QR code in Airtable? Nope, I don’t think you can do that.
It would be a pain to make the user do all this but you could generate the QR code on their device using the webviewer method above and then ask them to take a screenshot and tap a button in your app to upload the screenshot to Airtable from their photo album. Again, messy!
But again, you don’t actually have the image. It’s not a block value in Thunkable that you can manipulate. All you have is a web url. That’s not going to allow you to access the image that’s generated.
I had a thought. I bet there’s a way to extract an image from a url using an API. And you know what? There is! I don’t have it working yet but how sweet would that be if you could generate a url from the VIN # and then extract the QR code image with an API and have the png filename/url for use in your app? I think it’s possible now.
This looks promising: AI Platform | DataRobot although it doesn’t appear to be free. I tried this one for a bit, too, but couldn’t quite get the API call to work: https://urlmeta.org
I think we are thinking a bit too hard about this problem. I was surprised that the API is returning an actual image. Since that is the case you can display the image thus
It was just returning a png, but I can’t use it for anything, I can’t set an image to it, I can’t put it into firebase in an “attachment” collum, nothing.
It’s a pain in the butt, because it just crashed when you try