I'm trying to download a CSV file of exported contacts. The activity's completed successfully and I can see the download links on ConstantContact.com.
1. Your documentation on "How to get the exported file" (http://developer.constantcontact.com/docs/bulk_activities_api/bulk-activities-export-contacts.html) says:
"Once the activity completes processing (status = COMPLETE or ERROR in the activity status report), the status report will also include the file_name property, which is the URL where the file is hosted. The value of this property is a URI that points to the location of the exported file."
When I get the activity details, the "file_name" property is NULL. My frst question is, should there be a "file_name" or not?
I got on the forum and found a similar issue from 2014 (https://community.constantcontact.com/t5/Getting-Started-with-API-s/PHP-Export-Contacts-Questions/m-...). It seems as if there is still some confusion in the documentation above. Anyway, I tried the suggested solution but ran into another problem. I assumed that the xxxxxxxxxxxxxx.csv part of the URL on ConstantContact.com follows the pattern of <activity_id>.csv. Now the ID of the activity I fetched programmatically is different from what I see on the website and of course when I tried a GET request with the ID I got from code it failed.
My second question is, why would the ID be different on the website and when I fetch the activity programmatically?
Thanks very much.
I think that I know what the problem may be, but I am going to do some testing on my end to confirm. I will let you know what I find as soon as possible.
API Support Specialist
After further testing, I am confident that this is the cause of the issue.
From the information you provided, it appears that you are attempting to parse out the file_name from the getActivities call.
getActivities returns an array of Activity objects, which each include the Activity ID. You would then need to getActivity on each Activity object's Activity ID in order to get the file_name property.
While the file name ID and the Activity ID appear similar, they are not the same so using the Activity ID in its place will not work.
You mentioned that you tried a GET request with the Activity ID and it failed. Was the call described here the one you are seeing fail: http://developer.constantcontact.com/docs/bulk_activities_api/bulk-activities-status-detail-report-a...
API Support Specialist
Thanks for looking into this. I was trying what I saw here https://community.constantcontact.com/t5/Getting-Started-with-API-s/PHP-Export-Contacts-Questions/m-...
Let me try and get each activity as you've suggested and report back my findings. Thanks.