Campaign Id

172 views
Skip to first unread message

Damien

unread,
Jan 11, 2011, 11:13:36 AM1/11/11
to MailChimp API Discuss
Hi there,

I have been trying to use the mcapi to send out a nice newsletter as
people subscribe to the list.

I created the list and campaign manually. I had alot of difficulty
trying to find campaign id. Anyway I was told by mc help told me its
pulled from the url under campaigns.

ie.
http://us2.admin.mailchimp.com/campaigns/show?id=586249. The campaign
id would be "586249" (the number at the end of the url).

For me this is

http://us2.admin.mailchimp.com/campaigns/show?id=748245 - so 748245.

When I try this $response = $this->mcapi->campaignSendNow('748245');

It fails with a 300 error ----

["errorMessage"]=>
string(27) "Invalid Campaign ID: 748245"
["errorCode"]=>
int(300)

If I look in API I can see the list subscribe works but the campaign
Send Now fails.

Please help.

01/11/2011 04:10pm FAIL nope 94.170.94.127 campaignSendNow php 0.016s
MCAPI/1.2 1.2
01/11/2011 04:10pm SUCCESS nope 94.170.94.127 listSubscribe php
0.027s MCAPI/1.2 1.2

Damien

unread,
Jan 11, 2011, 11:15:08 AM1/11/11
to MailChimp API Discuss
Additionally,

I used the API to create a campaign and recieved a campaign id of
28ab49ad9e.

This id does work if I try campaignSendNow.



On Jan 11, 4:13 pm, Damien <dk...@whaddado.com> wrote:
> Hi there,
>
> I have been trying to use the mcapi to send out a nice newsletter as
> people subscribe to the list.
>
> I created the list and campaign manually.   I had alot of difficulty
> trying to find campaign id.  Anyway I was told by mc help told me its
> pulled from the url under campaigns.
>
> ie.http://us2.admin.mailchimp.com/campaigns/show?id=586249. The campaign
> id would be "586249" (the number at the end of the url).
>
> For me this is
>
> http://us2.admin.mailchimp.com/campaigns/show?id=748245- so 748245.

Williams Castillo

unread,
Jan 11, 2011, 11:20:10 AM1/11/11
to mailchimp-...@googlegroups.com
Hello Damien,

What you get by looking at the URL is what MailChimp calls Web ID... not the campaign ID you need to pass to any API call.

If you ever need to get the Campaign ID from a URL, you will need to fetch $api->campaigns that matches the Web ID parameters you got from the URL.... in other words, pass it in the "options" parameter (something like web_id => "ID_GOT_FROM_URL")

I hope it helps.


--
You received this message because you are subscribed to the Google Groups "MailChimp API Discuss" group.
To post to this group, send email to mailchimp-...@googlegroups.com.
To unsubscribe from this group, send email to mailchimp-api-di...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mailchimp-api-discuss?hl=en.


Paul Shriner

unread,
Jan 11, 2011, 1:40:05 PM1/11/11
to mailchimp-...@googlegroups.com
This is what I use, there is a series of other objects that you don't see here,but you can see, the method call structure:

        public List<DataObjects.Campaign.Campaign> GetAllCampaigns()
        {
            var mc = new MailChimp.MCApi(this.CustomerKey, true);
            var campaignList = mc.Campaigns();
            var returnList = new List<DataObjects.Campaign.Campaign>();
       

            for (int i = 0; i < campaignList.Total; i++)
            {
                var c = campaignList.Data[i];
            
                 returnList.Add( new DataObjects.Campaign.Campaign(){
                    CampaignName = c.Title,
                    ExtCampaignID = c.ID
                 });
            }
            

            return returnList;

        }

Then I bind the result to a ComboBox:

            var list = mc.GetAllCampaigns();            

            DropDownList1.DataSource = list;
            DropDownList1.DataTextField = "CampaignName";
            DropDownList1.DataValueField = "ExtCampaignID";
            DropDownList1.DataBind();
Reply all
Reply to author
Forward
0 new messages