West Wind Internet and Client Tools
Mail Chimp parms for httpget
Gravatar is a globally recognized avatar based on your email address. Mail Chimp parms for httpget
  n/a
  All
  May 14, 2014 @ 11:17am
Hi folks, been a while, eh?

So I've been messing around with Mail Chimp. They have an API that allows access to a variety of functions, including downloading your current mailing list and sending emails through them via a third party (i.e. VFP.) However, I haven't been able to figure out what the magic combination of parms to connect to their API is via West Wind.

This string works in the browser:

<<a href="http://us3.api.mailchimp.com/export/1.0/list?apikey=veryverysecret&id=alsosecret" target="top" >>http://us3.api.mailchimp.com/export/1.0/list?apikey=veryverysecret&id=alsosecret<</a>>

but passing it to httpConnect and httpGet in various combos like so:

cPrefix = '' (or '<<a href="http://" target="top" >>http://<</a>>' or 'https://')
cAPIkey = 'veryverysecret'
cListID = 'alsosecret'

cURL1= cPrefix + "us3.api.mailchimp.com"
cURL2 = "export/1.0/list"
o.httpconnect(cURL1)
o.AddPostKey("apikey",cAPIkey)
o.AddPostKey("id",cListID)

cURL1= cPrefix + "us3.api.mailchimp.com/export/1.0/"
cURL2 = "list"
o.httpconnect(cURL1)
o.AddPostKey("apikey",cAPIkey)
o.AddPostKey("id",cListID)

cURL1= cPrefix + "us3.api.mailchimp.com/"
cURL2 = "export/1.0/list?apikey="+cAPIkey+"&id="+cListID
o.httpconnect(cURL1)

and then

m.liResult=o.HTTPGet(cURL2, @m.lcStringReceived, @m.liText)

And always get o.cErrorMsg = "The server name or address could not be resolved"

If I stuff the entire URL into httpConnect and pass an empty string to httpGet, I get either "You must provide a server name (ie. www.somedomain or 111.111.111.121), not a URL." or "The URL is invalid" depending on if I'm passing http or https.

Suggestions?

Whil

Gravatar is a globally recognized avatar based on your email address. Re: Mail Chimp parms for httpget
  FoxInCloud Support - Thierry N.
  Whil Hentzen
  May 15, 2014 @ 12:48am
Hi Whil,

I would just try

response = o.HTTPget("http://us3.api.mailchimp.com/export/1.0/list?apikey=veryverysecret&id=alsosecret")


Hi folks, been a while, eh?

So I've been messing around with Mail Chimp. They have an API that allows access to a variety of functions, including downloading your current mailing list and sending emails through them via a third party (i.e. VFP.) However, I haven't been able to figure out what the magic combination of parms to connect to their API is via West Wind.

This string works in the browser:

but passing it to httpConnect and httpGet in various combos like so:

cPrefix = '' (or 'http://' or 'https://')
cAPIkey = 'veryverysecret'
cListID = 'alsosecret'

cURL1= cPrefix + "us3.api.mailchimp.com"
cURL2 = "export/1.0/list"
o.httpconnect(cURL1)
o.AddPostKey("apikey",cAPIkey)
o.AddPostKey("id",cListID)

cURL1= cPrefix + "us3.api.mailchimp.com/export/1.0/"
cURL2 = "list"
o.httpconnect(cURL1)
o.AddPostKey("apikey",cAPIkey)
o.AddPostKey("id",cListID)

cURL1= cPrefix + "us3.api.mailchimp.com/"
cURL2 = "export/1.0/list?apikey="+cAPIkey+"&id="+cListID
o.httpconnect(cURL1)

and then

m.liResult=o.HTTPGet(cURL2, @m.lcStringReceived, @m.liText)

And always get o.cErrorMsg = "The server name or address could not be resolved"

If I stuff the entire URL into httpConnect and pass an empty string to httpGet, I get either "You must provide a server name (ie. www.somedomain or 111.111.111.121), not a URL." or "The URL is invalid" depending on if I'm passing http or https.

Suggestions?

Whil


-- thn (FoxInCloud)

Gravatar is a globally recognized avatar based on your email address. Re: Mail Chimp parms for httpget
  Rick Strahl
  Whil Hentzen
  May 15, 2014 @ 10:49am
Whil,

AddPostKey() sets POST keys, but the API seems to be asking for querystring values for the ids. So you end up pushing a POST operation to an endpoint that likely only supports a GET...

+++ Rick ---



Hi folks, been a while, eh?

So I've been messing around with Mail Chimp. They have an API that allows access to a variety of functions, including downloading your current mailing list and sending emails through them via a third party (i.e. VFP.) However, I haven't been able to figure out what the magic combination of parms to connect to their API is via West Wind.

This string works in the browser:

but passing it to httpConnect and httpGet in various combos like so:

cPrefix = '' (or 'http://' or 'https://')
cAPIkey = 'veryverysecret'
cListID = 'alsosecret'

cURL1= cPrefix + "us3.api.mailchimp.com"
cURL2 = "export/1.0/list"
o.httpconnect(cURL1)
o.AddPostKey("apikey",cAPIkey)
o.AddPostKey("id",cListID)

cURL1= cPrefix + "us3.api.mailchimp.com/export/1.0/"
cURL2 = "list"
o.httpconnect(cURL1)
o.AddPostKey("apikey",cAPIkey)
o.AddPostKey("id",cListID)

cURL1= cPrefix + "us3.api.mailchimp.com/"
cURL2 = "export/1.0/list?apikey="+cAPIkey+"&id="+cListID
o.httpconnect(cURL1)

and then

m.liResult=o.HTTPGet(cURL2, @m.lcStringReceived, @m.liText)

And always get o.cErrorMsg = "The server name or address could not be resolved"

If I stuff the entire URL into httpConnect and pass an empty string to httpGet, I get either "You must provide a server name (ie. www.somedomain or 111.111.111.121), not a URL." or "The URL is invalid" depending on if I'm passing http or https.

Suggestions?

Whil



Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Gravatar is a globally recognized avatar based on your email address. Re: Mail Chimp parms for httpget
  n/a
  Thierry Nivelet (FoxInCloud)
  May 20, 2014 @ 10:56am
Thanks, Thierry, Rick,

Got that piece working nicely now. I was using some of my old code as a template, and had a mental block about using httpConnect.

Whil



Hi Whil,

I would just try

response = o.HTTPget("http://us3.api.mailchimp.com/export/1.0/list?apikey=veryverysecret&id=alsosecret")


Gravatar is a globally recognized avatar based on your email address. Re: Mail Chimp parms for httpget
  Michael B
  n/a
  Jan 11, 2021 @ 05:07pm

Hey FWIW this still works in 2021...

You simply add ?apikey=YOUR API KEY to their endpoint and it works as expected.

© 1996-2024