Page 1 of 1

ChuckNorris (Pulling Data using HTTPRequests)

PostPosted: Fri Dec 23, 2022 6:02 pm
by Daniel Kaminski
tolly random and useless but fun

make a function that is called ChuckNorris

Code: Select all
var str = ""
var msg = "https://api.chucknorris.io/jokes/random"
HTTPRequestToVar(msg,"str","GET","application/json")
var response = str.ToJson

return response.Get("value").ToString


you can now always get a ChuckNorris Joke by assigning it.

label1.text = ChuckNorris

Re: ChuckNorris (Pulling Data using HTTPRequests)

PostPosted: Tue Jan 10, 2023 10:57 pm
by odcheban
Pretty simple example, thank you!
But why it doesn't work for me... help me please

screen: https://drive.google.com/file/d/10x6I45 ... sp=sharing

code:
Label1.Text = "get response..."
var str = ""
var msg = "https://api.chucknorris.io/jokes/random"
HTTPRequestToVar(msg,"str","GET","application/json")
var response = str.ToJson
var str2 = response.Get("value").ToString
Label1.Text = str2

version: Wd 6.1.3. (free)
os: windows 10

Re: ChuckNorris (Pulling Data using HTTPRequests)

PostPosted: Wed Jan 11, 2023 12:49 pm
by Daniel Kaminski
because your WD Version is to old.
Upgrade to the latest Version and it will work.
You need Version 6.5.6

If you open the DebugLogger Windows it will tell you where the scripting has problems.

https://christiepandorasbox.com/root/do ... enu_wd.htm

Daniel

Re: ChuckNorris (Pulling Data using HTTPRequests)

PostPosted: Wed Jan 11, 2023 11:27 pm
by odcheban
Changing the version does not solve the problem.
I have the free version now, the paid version will be on Friday - then I will understand why it does not work.

Re: ChuckNorris (Pulling Data using HTTPRequests)

PostPosted: Fri Jan 13, 2023 4:00 am
by Daniel Kaminski
Please try this

Code: Select all
Label1.Text = "get response..."
var str = ""
var msg = "https://api.chucknorris.io/jokes/random"
HTTPRequestToVar(msg,"str","GET","application/json")
DebugMessage(str)


Post picture of DebugMessage.

Re: ChuckNorris (Pulling Data using HTTPRequests)

PostPosted: Fri Jan 13, 2023 11:00 am
by odcheban
Problem solved. I hope I didn't get the wrong version. Sorry