Getting data from json API

Im trying to get a quantum random number from this, typing in a web browser works fine:

https://qrng.anu.edu.au/API/jsonI.php?length=1&type=uint8

and you get this:

{"type":"uint8","length":1,"data":[224],"success":true}

It's the value in data (224) im after which is random every time you enter. Im very new to coding just so you know. But now im starting to get confused by all the tutorials and everything i can find, so please point me in the right direction.

Doing something simple like this doesn't work. But if i replace url with http://ip.jsontest.com/ it works, so internet connection shouldn't be a problem:

I get error 1101 Unable to get response with the specified URL, i get those mostly no matter how i try.

I don't really know where i should begin. Should i do a send request and do request headers first instead?
And not doing a simple "GET"?

I already tried using various tutorials, making lists or dictionaies, make it decode and hopefully get it to read the data i want. But im not sure if it retrieves any data at all. So im currently testing so i can at least see some raw data using a label component. I don't know if the "?length=1&type=uint8" part of the url should be anywhere at all. I even tried tinywebdb hoping it would be simpler.

I hope you know what kind of data im dealing with, it seems that the data is in an array 0 (using firefox):

4

I really wish i could show you my blocks of what i've tried but they are all a mess right now. I might post them later when i get the chance.

Anything that help is really appreciated
Thanks in advance!

All we need is the url block, which is cut off.

Please download and post each of those event block(s)/procedures here ...
(sample video)

Not sure where your problem is:

image

You get a json returned, you can use the dictionary or list blocks to get at your number

Watch out for that list [ ]

Capture herbertthe.aia (2.5 KB)

Yep:

I just tested on the companion app and that works! It doesn't work with the desktop emulator it seems.

Wow thanks alot! Thats more than i expected and it works!

I have a question related to JSON data from API to Dictionary. My question is which block I should use between "Global Variable" and "response Content" which is JSON data from API. See pictures for more details of my project. Thanks all.
SMSdata
JSONdata

This one

image

(in the web component)

1 Like

Use call Web.JsonTextDecodeWithDictionaries block

1 Like

Thank TIMAI2 and Dora_paz. I tried and was successful.

1 Like