PHP Export Contacts Questions

Occasional Participant

PHP Export Contacts Questions


I believe I have successfully completed an Export Activity and I want to download the CSV - Doc says:


'Once the activity has completed processing, the status includes a file_name property with the URI pointing to the exported file. Make a GET call to the URI to retrieve the file.'


I'm not sure I totally understood above statement - I ran a status check and found the following:


class Ctct\Components\Activities\Activity#26 (8) {
public $id =>
string(19) "a07e8x4jxs1hrikdjpo"
public $type =>
string(15) "EXPORT_CONTACTS"
public $status =>
string(8) "COMPLETE"
public $start_date =>
string(24) "2014-02-11T02:42:37.266Z"
public $finish_date =>
string(24) "2014-02-11T02:42:37.545Z"
public $created_date =>
string(24) "2014-02-11T02:42:08.268Z"
public $error_count =>
public $contact_count =>


I don't see that the 'status includes a file_name property'. So I tried moving on to the second part of the doc which I believe says to retrieve the doc using:




so I tried the following:


I got the following response:


"error_message":"The Mashery account associated with this request is not active, or an invalid API key was used."


I also tried various things like adding my token to the GET headers and adding my api key to the url but to no avail


Any thoughts?





I need to look at the return again to see if the docs are wrong for the 1st part of your question. For the 2nd part, just add the api_key query parameter to the GET call you made to retrieve the file,<your_api_key>


Let me check the docs and the return, I'll get back on that shortly.



Rich Marcucella

Sr. Technical Writer, Content Developer

Web Services Team.

Rich Marcucella
Sr. Technical Writer, Content Developer
Web Services Team
Occasional Participant


Thanks for the response!  Success - I had tried the key and the token but not both together - so using query params, the following worked:<activity_id>.<file_extension>?api_key=<my_api_key>&access_token=<my_access_token>

Rob, glad it worked for you. I've created a bug to make the documentation more specific about what's required to access the exported file, and to clarify some of the other info there about the activity status, etc. 


Thanks for posting, it will definitely help make the docs and portal better for you guys.



Rich M

Rich Marcucella
Sr. Technical Writer, Content Developer
Web Services Team
Developer Portal

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

Visit Page