asp.net - Using Campaign Monitor's API -


i looking way use campaign monitor's api in asp.net/vb web application. have not used api before, reading documentation difficult understand.

if has used , able provide instructions appreciate it; or if has general usage instructions (if applied on api), guest! :)

i know not typical "i have problem , problem , here's effort far" appreciated.

i use campaign monitor populating subscriber lists.

there 2 methods post subscribers lists. i'm going stick simplest one. let's round somethings need first.

  1. you'll need api key (which sure have).

  2. you'll need create subscribers list , after create list you'll need list id. id (which wierd).you'll need click subscriber list. towards top. single opt-in list (change name/type) note: not going change name or edit have click in here id. on third section see this: api subscriber list id. if you're using api, you'll need id access list. 000x0000xx0x0xx00x00xx (just example.)

  3. you'll need form capture name , email. you'll need listid got in previous point.

then you'll need code communication object.

if doing straight forward call you'll need name, email, , listid.

listid ="000x0000xx0x0xx00x00xx"; email ="joem@somethingemail.com"; name = "joe middle";  apikey = yourapikey; apiurl = "http://api.createsend.com/";   apicall = variables.apiurl; apicall &= "api/api.asmx/subscriber.add?apikey=" & variables.apikey; apicall &= "&listid=" & urlencodedformat(arguments.listid); apicall &= "&email=" & urlencodedformat(arguments.email);  apicall &= "&name=" & urlencodedformat(arguments.name); 

once have url build use whatever method .net uses post http.

then you'll want code success or fail , info. post http , call result. apiresult.

apiresult = xmlparse(apiresult.filecontent); try {intcount = arraylen(apiresult.result.xmlchildren);} catch(any e){intcount = 0;} if (intcount gt 0){apiresult = apiresult.result.xmlchildren;} // error handling if ( apiresult[1].xmlname eq "code" , apiresult[2].xmlname eq "message" ){ returnstruct['blnsuccess'] = 0; returnstruct['errorcode'] = apiresult[1].xmltext; returnstruct['errormessage'] = apiresult[2].xmltext; } // success else { // return str returnstruct['blnsuccess'] = 1; returnstruct['returnstring'] = apiresult.result.xmltext; }     

the code above adapted coldfusion , didn't build cfscript not cfml , can kind of interpret happening.

if adapt .net missing http call stuff method.

to check log campaign monitor , click on list. should see additions showing up, if not either api key (not case), listid (could case), code (most culprit).

this hammered out in hurry apologies if flow weird.

good luck!


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -