Creating Campaing via API and CMBase.php

I am unable to create a new campaign via the API using the CMBase.php calls.

I simply edited the Campaign.Create.php file supplied with the API to include my specific API keys/ids and am not getting any love.

Here is the code I get back when I view the debuging info. (edited to hide my API keys)

  [url]=> http://api.createsend.com/api/api.asmx
    [soapAction] => http://api.createsend.com/api/
    [api] => xxxxxxxxxxxxxxxxxx 
    [campaign_id] => 
    [client_id] => 
    [list_id] => 
    [method] => soap
    [curl] => 1
    [curlExists] => 1
    [debug_level] => 1
    [debug_request] => <?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
    <Campaign.Create xmlns="http://api.createsend.com/api/">
        <ApiKey>xxxxxxx</ApiKey>

        <ClientID>cidcidcidcidcidcidcidcidcid<ClientID>
        <CampaignName>March newsletter<CampaignName>
        <CampaignSubject>March newsletter<CampaignSubject>
        <FromName>John Smith<FromName>
        <FromEmail>john@smith.com<FromEmail>
        <ReplyTo>john@smith.com<ReplyTo>

        <HtmlUrl>http://www.campaignmonitor.com/uploads/templates/previews/template-1-left-sidebar/index.html<HtmlUrl>
        <TextUrl>http://www.campaignmonitor.com/uploads/templates/previews/template-1-left-sidebar/textversion.txt<TextUrl>
        <SubscriberListIDs>
            <string>listidlistidlistis<string>
        <SubscriberListIDs>
        <ListSegments><ListSegments>
    </Campaign.Create>

</soap:Body>
</soap:Envelope>
    [debug_response] => HTTP/1.1 400 Bad Request
Connection: close
Date: Tue, 10 Mar 2009 01:07:02 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Length: 0


    [debug_url] => http://api.createsend.com/api/api.asmx
    [debug_info] => Array
        (
            [url]=> http://api.createsend.com/api/api.asmx
            [http_code] => 400
            [header_size] => 206
            [request_size] => 1246
            [filetime] => -1
            [ssl_verify_result] => 0
            [redirect_count] => 0
            [total_time] => 0.119047
            [namelookup_time] => 0.001953
            [connect_time] => 0.059788
            [pretransfer_time] => 0.059936
            [size_upload] => 0
            [size_download] => 0
            [speed_download] => 0
            [speed_upload] => 0
            [download_content_length] => 0
            [upload_content_length] => 0
            [starttransfer_time] => 0.11887
            [redirect_time] => 0
            [headers_sent] => Array
                (
                    [0] => User-Agent: CMBase URL Handler 1.5
                    [1] => Content-Type: text/xml; charset=utf-8
                    [2] => SOAPAction: "http://api.createsend.com/api/Campaign.Create"
                )

        )

    [show_response_headers] => 1

If any one can provide some insight to this it would be greatly appreciated.

Alex D, 7 years ago

Has any one been successful in creating a new campaign using the API via PHP???


Alex Duffield - Owner
InControl Solutions
http://www.incontrolsolutions.com
Alex D, 7 years ago

It seems I must have been using an older version of CMBase.php as I just re-downloaded it and all is working now..

Might be a nice idea to include the version number in the top of subsequent releases... :-)


Alex Duffield - Owner
InControl Solutions
http://www.incontrolsolutions.com

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098