I am trying to create a campaign but I am constantly getting the following error:
The following error was returned : ListsID's or Segments Required
Can someone tell me the format of the values to be passed in the last two parameters in Campaign.Create .
I'm getting the same error whenever I try to use Campaign.Create. We've tried with SubscriberListIDs, ListSegments, and both. Every time, we get this response:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><Campaign.CreateResponse xmlns="http://app.campaignmonitor.com/api/"><Campaign.CreateResult><Code>315</Code><Message>ListsID's or Segments Required</Message></Campaign.CreateResult></Campaign.CreateResponse></soap:Body></soap:Envelope>
Here's an example of an exact SOAP request (with IDs removed):
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://app.campaignmonitor.com/api/"> <SOAP-ENV:Body> <ns1:Campaign.Create> <ApiKey>XXXXXXXXXXXXXXXXXXXXXXXXXXX</ApiKey> <ClientID>XXXXX</ClientID> <CampaignName>my campaign</CampaignName> <CampaignSubject>Test subject</CampaignSubject> <FromName>My Name</FromName> <FromEmail>firstname.lastname@example.org</FromEmail> <ReplyTo>email@example.com</ReplyTo> <HtmlUrl>http://example.com/cm/2008-07-10.html</HtmlUrl> <TextUrl>http://example.com/cm/2008-07-10.txt</TextUrl> <SubscriberListIDs> <int>XXXXXXXX</int> </SubscriberListIDs> </ns1:Campaign.Create> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Just to follow up... we're getting the same 315 "ListsID's or Segments Required" for every request to Campaign.Create, even for blank requests like the following:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://app.campaignmonitor.com/api/"><SOAP-ENV:Body><ns1:Campaign.Create/></SOAP-ENV:Body></SOAP-ENV:Envelope>
Here's some more information about another API call: Client.GetCampaigns.
I submit this request:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://app.campaignmonitor.com/api/"><SOAP-ENV:Body><ns1:Client.GetCampaigns><ApiKey>XXXXXXXXXXXXXXXXXXXXXX</ApiKey><ClientID>XXXXXX</ClientID></ns1:Client.GetCampaigns></SOAP-ENV:Body></SOAP-ENV:Envelope>
And I get a SOAP fault with what appears to be a .NET stack trace beginning with:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Procedure or function 'SU_GetPastCampaignsFromAPI' expects parameter '@APIKey', which was not supplied.
I've tried this using both SOAP versions 1.1 and 1.2 (as well as the above posts).
Hope this helps!
The first thing we do in the code for this API method it check to see if the ListID's or Segments have been passed in correctly, and if they haven't, we return the error code that you are seeing.
Could you post the code you are actually using to send your api request?
And sowsinsk, from your last post it looks like all of your data isn't getting posted at all - that's why your getting the APIKey problem. Would you be able to also post your code?
I'm getting this same error, using the provided PHP5 API from the API site.
[code] $params = array(
"Campaign Name" => $_GET["Name"],
"Campaign Subject" => $_GET["Name"] . "-subject",
"From Name" => "API CreateCampaign testing",
"From Email Address" => "firstname.lastname@example.org",
"Reply To Email Address" => "email@example.com",
"HTML Content URL" => "http://xxx/cm/html",
"Text Content URL" => "http://xxx/cm/text",
"Subscriber Lists" => array(111111)
$result = $cm->makeCall("Campaign.Create", $params);
I realize that my "Subscriber Lists" may not be formatted correctly, but I've also tried:
[code]"Subscriber Lists" => array(0 => 111111)[/code]
I've also tried creating a list segment and passing that, even though I likely won't be using them. Same error:
[code] => 315
[Message] => ListsID's or Segments Required
I realize that I'm probably passing "Subscriber Lists" in incorrectly, but I'm pretty sure that at least one of the ways I tried to pass it should have been valid (having tried many).
Are you using this new API Library - http://code.google.com/p/campaignmonitor-php/
With this you should just be able to call the campaignCreate method which should handle the details for you.
No, but I'll look into that pretty quickly. I found a few problems, one being that my ListIDs weren't enclosed in <int> tags (effectively limiting the current PHP API that I'm using to a single list due to limitations of PHP's array), another in that the API wasn't sending my ClientID.
Lastly I found a problem with the Campaign.Create documentation.
Subscriber Lists An array of lists to send the campaign to.
Okay, cool. "An array of lists" isn't defined but I can check the code request sample down below...
<CampaignName>string</CampaignName> <CampaignSubject>string</CampaignSubject> <FromName>string</FromName> <FromEmail>string</FromEmail> <ReplyTo>string</ReplyTo> <HtmlUrl>string</HtmlUrl> <TextUrl>string</TextUrl> <SubscriberListIDs> <int>int</int> <int>int</int> </SubscriberListIDs>
Wait a minute, not only does "Subscriber Lists" not match "SubscriberListIDs" - the tags within the code sample don't match the parameters listed in the top section of the documentation at all.
But thanks for the link to this newer API, I'll be grabbing and using it shortly. Right now it looks like I'm using version 1.0 (linked on your site here: http://campaignmonitor.com/api/samples/default.aspx#php) and the version over there is 1.1.1.
So my problems in short (which should be fixed by using the newer API .php file):
1) Using an older PHP (which is linked on your site to an old version), and
2) API documentation inconsistency, namely "Parameters and required information" differs drastically from the "SOAP 1.1" section, where the latter is up to date and the former is not.
Thanks for the update. We will definitely fix the documentation, and we'll be pointing to the new version of the PHP wrapper very soon, we just wanted a few people to test it out first.