Exec, cURL for accessing Google Analytics API

Q&A's, tips, howto's
Locked
hilti
Posts: 140
Joined: Sun Apr 19, 2009 10:09 pm
Location: Hannover, Germany
Contact:

Exec, cURL for accessing Google Analytics API

Post by hilti »

Hi

I need some help in accessing the Google analytics data API. My problem is:

Code: Select all

;; use of curl because newLISP get-url doesn't work with HTTPS
;; save response token
(set 'token (exec "curl 'https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&service=analytics&Email=user@gmail.com&Passwd=mysecretpasswd' "))
(print token)
This way I got a string back from Google for authentication. But how Do I replace Email and Passwd with variables? I don't get it. I tried this:

Code: Select all

;; use of curl because newLISP get-url doesn't work with HTTPS
;; save response token
(set 'email "user@gmail.com")
(set 'passwd "secret")
(set 'token (exec "curl 'https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&service=analytics&Email='"email"'&Passwd='"passwd"' "))
(print token)
Thanks for help!
--()o Dragonfly web framework for newLISP
http://dragonfly.apptruck.de

Kazimir Majorinc
Posts: 388
Joined: Thu May 08, 2008 1:24 am
Location: Croatia
Contact:

Re: Exec, cURL for accessing Google Analytics API

Post by Kazimir Majorinc »

Use append?

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: Exec, cURL for accessing Google Analytics API

Post by cormullion »

How about:

Code: Select all

(set 'token (exec (string "curl 'https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&service=analytics&Email=" email "&Passwd=" passwd "'")))
or append, or format...?

hilti
Posts: 140
Joined: Sun Apr 19, 2009 10:09 pm
Location: Hannover, Germany
Contact:

Re: Exec, cURL for accessing Google Analytics API

Post by hilti »

Thanks everyone. I was a blockhead.

I'll publish the script when it's ready.

Cheers
Hilti
--()o Dragonfly web framework for newLISP
http://dragonfly.apptruck.de

Locked