- Constant Contact Community
- :
- Developer Community
- :
- Authentication and Access (ie. 401 errors!)
- :
- The requested URL returned error: 400
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
The requested URL returned error: 400
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-09-2012 03:45 PM
// If the subscriber already exists then we're updating their list choices
if( $iContactId = $oConstantContact->subscriberExists($aPostFields['email_address']) ){ $sContactXML = $oConstantContact->createContactXML( $iContactId, $aPostFields ); $bError = !$oConstantContact->editSubscriber( $iContactId, $sContactXML ); }else{ // New Contact $sContactXML = $oConstantContact->createContactXML( null, $aPostFields ); $bError = !$oConstantContact->addSubscriber($sContactXML); }
The error is occuring at the last line, addSubscriber. the "The requested URL returned error: 400" is being echo'd into my page, i didnt tell it to echo.
Re: The requested URL returned error: 400
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-09-2012 06:06 PM
Hello,
The 400 error is most commonly caused by some problem with the structure or content of the XML being submitted in your request body. It may be helpful to dump that $sContactXML variable to your browser, and take a look at it... You can post it here (remove any unique identifiers for the contact before posting). You can also PM it to me, if you are more comfortable with that.
Cheers,
Support Engineer
Re: The requested URL returned error: 400
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-10-2012 11:09 AM
<entry xmlns="http://www.w3.org/2005/Atom">
<title>TitleNode</title>
<updated>
2012-04-10T11:07:56+01:00
</updated>
<author>
<name>CTCT Samples</name>
</author>
<id>urn:uuid:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<
<summary type="text">Customer document</summary>
<content type="application/vnd.ctct+xml">
<Contact xmlns="http://ws.constantcontact.com/ns/1.0/">Customer document
<EmailAddress>asdf@asdf.com</EmailAddress>
<FirstName>First Name*</FirstName>
<LastName>Last Name</LastName>
<MiddleName></MiddleName>
<CompanyName></CompanyName>
<OptInSource>ACTION_BY_CUSTOMER</OptInSource>
<HomePhone>Phone Number</HomePhone>
<WorkPhone></WorkPhone>
<Addr1></Addr1>
<Addr2></Addr2>
<Addr3></Addr3>
<City>City</City>
<StateCode></StateCode>
<StateName>State</StateName>
<CountryCode></CountryCode>
<PostalCode></PostalCode>
<SubPostalCode></SubPostalCode>
<Note>contact</Note>
<EmailType>HTML</EmailType>
<ContactLists>
<ContactList id="https://api.constantcontact.com/ws/customers/black
</ContactLists>
</Contact>
</content>
</entry>
Re: The requested URL returned error: 400
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-10-2012 11:28 AM
ah, the error was i wasnt setting the lists url properly. This is the second time i've had error: #someNumber. It sure would be nice if this api gave some more info back.
Re: The requested URL returned error: 400
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-10-2012 11:42 AM
Hello,
I'm glad the cause of the error revealed itself in the XML. With the 400 errors that is usually the case. I'm also going to look at the error handling and how they are reported by the wrapper. It may take me a little time to do that, but in the meantime, I can direct you to this documentation on the API error codes.
Cheers,
Support Engineer
Re: The requested URL returned error: 400
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-10-2012 04:22 PM
Based on the name of the function called in the original code you posted, it looks like you are using the CCSFG. In that package, the file cc_class.php library contains the code that is echoing the error returned by the doServerCall function that starts around line 46 of the unaltered file. I believe you're looking for the following line:
echo $return['error'];
which occurs on line 89 of the unaltered script. This can be commented out or revised to write the API call errors to a file.
I hope this was helpful. Let me know if you have any other questions.
Support Engineer


