cancel
Showing results for 
Search instead for 
Did you mean: 
Constant Contact wants to help you succeed! We’re celebrating our professional service programs on the Constant Contact Community this month and you have a chance to try one of the services for free! Learn more.

Using the https://api.cc.email/v3/contact_exports/ api

SOLVED
Occasional Participant

Using the https://api.cc.email/v3/contact_exports/ api

I am using the href generated from the activity status once the status is completed.

Making a get request, the response status code is OK, content-type is text/csv but content-length is 0. 

What am I missing to get the csv file returned in the responseexport.png?

 

Tags (3)
5 REPLIES 5
Moderator

Re: Using the https://api.cc.email/v3/contact_exports/ api

Hello @JohnD16884,

 

Thank you for reaching out to Constant Contact's API Support.

 

It appears there are some differences in our documentation. The documentation says you need to add the word "activities" before the word "contact_exports" in the endpoint URL. Let me test this and reach out to our developers to see which one is the correct way and get this taken care of.


Regards,
Jimmy D.
Tier II API Support Engineer
Occasional Participant

Re: Using the https://api.cc.email/v3/contact_exports/ api

I agree, there is conflicting documentation and examples. A curl example of how to GET the text-csv file would be a great resource. I cannot find anything in the docs or community. Thanks for looking at this, Jimmy.

Moderator

Re: Using the https://api.cc.email/v3/contact_exports/ api

Hi @JohnD16884,

 

We are working on getting everything updated. I did some testing and here is what is needed to do an export.

 

- POST: https://api.cc.email/v3/activities/contact_exports

-- This requires the correct body to be included.

-- You will receive results shown below. note: the link labeled self = activity ID and link labeled results = filed ID

{
  "activity_id": "9da45782-bee4-11e9-96cf-d4ae52843aae",
  "state": "initialized",
  "started_at": "completed",
  "completed_at": "2016-01-23T13:48:44.108Z",
  "created_at": "2016-01-23T13:48:44.108Z",
  "updated_at": "2016-01-23T13:48:44.108Z",
  "percent_done": 75,
  "activity_errors": [
    "Message describing the error condition."
  ],
  "status": {
    "items_total_count": 8751,
    "items_completed_count": 351
  },
  "_links": {
    "self": {
      "href": "/v3/activities/9da45782-bee4-11e9-96cf-d4ae52843aae"
    },
    "results": {
      "href": "/v3/contacts_exports/9da2b17a-bee4-11e9-96cf-d4ae52843aae"
    }
  }
}

- GET: https://api.cc.email/v3/activities/{activity_id)

-- You will get a results page that looks similar. Specifically look for "percent_done" and make sure it says 100

{
  "activity_id": "9da45782-bee4-11e9-96cf-d4ae52843aae",
  "state": "initialized",
  "started_at": "completed",
  "completed_at": "2016-01-23T13:48:44.108Z",
  "created_at": "2016-01-23T13:48:44.108Z",
  "updated_at": "2016-01-23T13:48:44.108Z",
  "source_file_name": "2016-21-04-contact_import.csv",
  "percent_done": 100,
  "activity_errors": [
    "Message describing the error condition."
  ],
  "status": {
    "items_total_count": 2200,
    "items_completed_count": 2100,
    "person_count": 8750,
    "error_count": 0,
    "correctable_count": 0,
    "cannot_add_to_list_count": 0,
    "list_count": 3
  },
  "_links": {
    "self": {
      "href": "/v3/activities/9da45782-bee4-11e9-96cf-d4ae52843aae"
    },
    "results": {
      "href": "/v3/contacts_exports/9da2b17a-bee4-11e9-96cf-d4ae52843aae"
    }
  }
}

- GET: https://api.cc.email/v3/contact_exports/9da2b17a-bee4-11e9-96cf-d4ae52843aae

-- This should give you a result of the email addresses you requested.

 

 

 

 


Regards,
Jimmy D.
Tier II API Support Engineer
Occasional Participant

Re: Using the https://api.cc.email/v3/contact_exports/ api

 

I was able to get the api to work by trimming down my fields list to email_address only. I was trying to include a custom field in the fields list and obviously did not have the correct value, so once the bulk export process was "complete", I was able to retrieve the csv stream but response.content.length was always 0. Unfortunately, there was no error thrown so it wasn't until I changed the initial bulk export request to pass just the email_address only in the fields list that I was able to get a response.content with a stream I could process. 

 

Moderator

Re: Using the https://api.cc.email/v3/contact_exports/ api

Hi @JohnD16884,

 

You can export the custom fields; however I noticed it is not listed in our documentation, or the schema on our API Reference page. We are still working on the details at this point; however you can export all fields by not specifying the "fields" section at all. This will export every field including custom fields. Here is an example of what I used, of course the contact listID will be different for you.

 

{
  "list_ids": [
    "f5cb02a0-88c7-11e5-9497-d4ae5275b546"
  ],
  "status": "active"
}

Regards,
Jimmy D.
Tier II API Support Engineer