I'm trying to retrieve the campaigns of our clients using clientGetCampaigns($client_id) but I'm receiving an empty array. Using the same Client ID I can fetch the Client details with no problems at all.
I'm using the following code.
$cm = new CampaignMonitor( $apikey ); $campaigns_details = $cm->clientGetCampaigns($clientid); print_r($campaigns_details);
Have the campaigns you are trying to retrieve already been sent? Please note that the Client.GetCampaigns method retrieves campaigns which have been sent, not those which are in draft status.
From the documentation for this method at http://www.campaignmonitor.com/api/method/client-getcampaigns/
"Gets a list of all campaigns that have been sent for a client."
I have verified that your code above works in the case when campaigns have already been sent for a client.
Hope that helps.
I already sorted out this issue. I've learned that the campaign is hidden from the client. Thats why it can not be retrieved using the client id.
Is there a way also to retrieve "Draft" campaign? I noticed also that theres no way to update Campaign via API?
Unfortunately we don't currently have a feature to retrieve drafts ("Client.GetDrafts").
We've added your vote for the addition of the "Client.GetDrafts" method as well as a "Campaign.Update" method.
I can't really give a time frame for when these will be implemented, as we need to prioritise the large number of feature requests we receive. This thread will be updated when these features are implemented.
Thanks for the feedback.
Thanks for the reply. One more thing is there a way to retrieve the Campaign Name instead of the Campaign Subject? I noticed that Client.GetCampaigns it returns just the subject.
Yes, your observation is correct. There is a known issue with the campaign returned - it contains a Subject field, but is missing the Name field.
We are hoping to be able to correct this soon, but at the same time don't want to break any existing code which calls the API.
Just alerting API developers that we've now updated the Client.GetCampaigns method to include both the campaign name and subject.