Creating an Export Contacts Activity Not working -Error in constant contact api

Highlighted
Occasional Participant

Creating an Export Contacts Activity Not working -Error in constant contact api

I'm a dotnet developer.

I was trying to create a process to export a contact list and check the status of the activity using the below mentioned parameters and using Export Contacts Activity.

"activityType=EXPORT_CONTACTS&fileType=CSV&sortBy=DATE_DESC&columns=EMAIL+ADDRESS&listId=http%3a%2f%2fapi.constantcontact.com%2fws%2fcustomers%2f" + sUsername + "%2flists%2fdo-not-mail";

HTTP status what i'm getting is always 201 created, but in my xml response the status is always PENDING.But even then i'm able to download the CSV file from my local development machine(Windows XP).

But when i moved the code to our web server which is in client place the same code is not working it is giving 400 Bad request exception.

Please see the attached XML response.

Can anyone tell me is it an error with the API? or is it an security issue with the server?


Thanks in advance
Hyma
3 REPLIES 3
Highlighted
Moderator

RE: Creating an Export Contacts Activity

Is that the response you are getting when you receive the 201 response or the 400 response? That XML document indicates that the csv file creation is currently pending, which would indicate a 201 response should have been given.
Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Participant

I am getting a 201 response.

I am getting a 201 response. In my code, if the response is 201, I am trying to read the csv file. But I am getting the "bad request" error. Is there something wrong with my code ?
Highlighted
Moderator

RE: I am getting a 201 response.

The 201 response will be returned if the activity creation is correct. After that, you must follow up by using the new URI for the created activity to ensure it goes from "Pending" to "Complete" (there is also the status of "Queued" and "Running" that will come up during the actual processing time). Please keep in mind, once you set up an activity, it can take anywhere from 5 minutes to 2 hours depending on how complex the activity is as well as the current queue of other customers activities for this to process.

Once the activity is completed, you should follow the steps outlined below:

If the new activity is created successfully, the server will return an HTTP status of 201 Created. The HTTP Location header in the response will contain the URI of the newly created activity, and the entity body returned will be the minimal entry for the activity, including server-generated values like ids and links.

After the system has finished processing the Export activity, retrieving the activity entry will return a complete entry that includes the status of the job. If the job completed successfully, it will also contain a link to the exported file. See the example below: Here
Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

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

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More
Featured