How do i use Dark Sky API with livecode?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jolleboi
Posts: 3
Joined: Sat Mar 11, 2017 6:38 pm

How do i use Dark Sky API with livecode?

Post by jolleboi » Sat Mar 11, 2017 6:41 pm

Hey Guys
I am a beginner with livecode and i can't for the life of me figure out how to call for the API and use the data that it gives me. I have integrated the easyjson script in my stack and pasted the:

" $_GET url "

and i get nothing. I am probably missing alot but i don't know how to get it to work, i've googled alot and to be honest there isn't that much about livecode stuff...

My goal is to create a weather app

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: How do i use Dark Sky API with livecode?

Post by shaosean » Sun Mar 12, 2017 5:11 am

Post some links to what you're talking about, so we can take a look..

jolleboi
Posts: 3
Joined: Sat Mar 11, 2017 6:38 pm

Re: How do i use Dark Sky API with livecode?

Post by jolleboi » Sun Mar 12, 2017 1:17 pm

I wanna use the API from here darksky(dot)net/dev/docs/forecast and i dont know how to "call" for the data it has available

ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Re: How do i use Dark Sky API with livecode?

Post by ClipArtGuy » Sun Mar 12, 2017 11:59 pm

This should get you started. You won't need easyJSON, because the newer JSONimport function works just great. Just replace YOUR KEY HERE with your secret key from darksky and throw this script into button.

Code: Select all

on mouseUp
   get url "https://api.darksky.net/forecast/YOUR KEY HERE/42.3601,-71.0589"
   put it into tForecast  
   put JSONimport(tForecast) into tForecastArray
   answer "It is currently"&&tforecastarray[currently][temperature]&&"degrees and"&&tforecastarray[currently][summary]
end mouseUp

jolleboi
Posts: 3
Joined: Sat Mar 11, 2017 6:38 pm

Re: How do i use Dark Sky API with livecode?

Post by jolleboi » Mon Mar 13, 2017 11:36 am

ClipArtGuy wrote:This should get you started. You won't need easyJSON, because the newer JSONimport function works just great. Just replace YOUR KEY HERE with your secret key from darksky and throw this script into button.

Code: Select all

on mouseUp
   get url "https://api.darksky(dot)net/forecast/YOUR KEY HERE/42.3601,-71.0589"
   put it into tForecast  
   put JSONimport(tForecast) into tForecastArray
   answer "It is currently"&&tforecastarray[currently][temperature]&&"degrees and"&&tforecastarray[currently][summary]
end mouseUp
Oh thank you this is great, i've been trying to get it to show directy on the screen with

on start

end start

but yeah that didnt work, how do i make it show right on the card all the time and not just in a pop up window when i click on a button?

Thanks again mate!

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: How do i use Dark Sky API with livecode?

Post by shaosean » Mon Mar 13, 2017 2:15 pm

put it in to a field

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How do i use Dark Sky API with livecode?

Post by Klaus » Mon Mar 13, 2017 6:08 pm

Hi jolleboi,

1. welcome to the forum! :D

2. Looks like you could need some basics about LC, check these great learning resources:
http://www.hyperactivesw.com/revscriptc ... ences.html

Best

Klaus

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”