No activityTYpe specified

roy_ittoo
Occasional Participant

No activityTYpe specified

hI

Please help. I have been trying to find out whats wrong for the past couple of hours ...

activityType=SV%5FADD&data=Email+Address%2CEmail+Type%2CFirst+Name%2CLast+Name%0Ablah%40blah%2Ecom%2C+HTML%2C+blah%2C+Test&lists=https%3A%2F%2Fapi%2Econstantcontact%2Ecom%2Fws%2Fcustomers%2Fmylist%2Flists%2F1


This is the data being posted...but yet the Server responding with error 400 - NO activityTYpe specified....

Any suggestion please ...
3 REPLIES 3
DaveBerard
Moderator

I tested your encoded form in my own account by changing just the account name (mylist to my actual account name). In both a C# sample program and our REST debugging tool, it posted a 201 created without issue. The problem most likely is in your actual code doing the submit.
Dave Berard
Senior Product Manager, Constant Contact
roy_ittoo
Occasional Participant

HI dave,

Thanks for your reply..

Yes ... I tried it on a Vb.net page and its working fine.

The problem is that I have to do this as an ASP page ...

Here is my ASP code... note however that this has been patched up thru a series of trial and error...
ANd moreover I think if we can crack this ...this can then be of some use to other users of the forum...cause there are other people looking for an ASP equivalent... but unfortunately this is one route /option which does not seem to be popular hence not much information available. But unfortunately I cannot use a .net page for this one.

Note that i am using SV_ADD here to add one record although it should be used normally for BULK Contacts... The Purpose of the page is to do a sort of end of day procedure so sometimes it may happen that there will be just 1 record to update...but normally we expect to have more than 1 per day.

Thanks for looking into this.

Here it goes

=====VBSCRIPT =======
sUsername = "USERNAME"
sPassword = "PASSWORD"
sUri = "http://api.constantcontact.com/ws/customers/" & sUsername & "/activities"
sListUri = "https://api.constantcontact.com/ws/customers/" & sUsername & "/lists/1"
sAPIKey = "APIKEY"

sAuthorisation = sAPIKey & "%" & sUsername

set myRequest = Server.Createobject("Microsoft.XMLHTTP")

sData = "activityType=" & Server.URLEncode("SV_ADD")
sData = sData & "&data=" & Server.URLEncode("Email Address,Email Type,First Name,Last Name"&chr(10))
sData = sData & Server.URLEncode("blah@blah.com" & ", HTML, " & "BLAH, BLAH" )
sData = sData & "&lists=" & Server.URLEncode(sListUri)

Call myRequest.open("POST",sUri,False,sAuthorisation, sPassword)
Call myRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
Call myRequest.send

Response.Write(myRequest.ResponseText)
Response.Write(sData)
Set myRequest = Nothing
==========================================================
DaveBerard
Moderator

I'm looking over your code and I think I see an issue here. There is no send of the sData variable. The actual function to send the information should be:

Call myRequest.send(sData)

This will send the sData information in the actual request send. I'm unable to test this in my current enviroment, I'm looking to see if I can get a classic ASP test environment set up though to try this out.
Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

View API documentation, code samples, get your API key.

Visit Page