400 Bad Request creating a new campaign

SOLVED
Go to solution
user96514
Campaign Collaborator
0 Votes

Hi all

 

We are trying to create a campaign through your API. 

Sometimes it worked, but sometimes we received a 400 Bad Request, as in this case: 

method: POST url: https://api.cc.email/v3/emails payload: {'json': {'name': 'My new message-1571836258463', 'email_campaign_activities': [{'format_type': 1, 'from_email': 'cinzia.caleffi@beefree.io', 'from_name': 'cinzia.caleffi@beefree.io', 'reply_to_email': 'cinzia.caleffi@beefree.io', 'subject': '<%subject%>', 'html_content': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">\n\n<head>\n\t<!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]-->\n\t<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n\t<meta name="viewport" content="width=device-width">\n\t<!--[if !mso]><!-->\n\t<meta http-equiv="X-UA-Compatible" content="IE=edge">\n\t<!--<![endif]-->\n\t<title></title>\n\t<!--[if !mso]><!-->\n\t<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">\n\t<!--<![endif]-->\n\t<style type="text/css">\n\t\tbody {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\n\t\ttable,\n\t\ttd,\n\t\ttr {\n\t\t\tvertical-align: top;\n\t\t\tborder-collapse: collapse;\n\t\t}\n\n\t\t* {\n\t\t\tline-height: inherit;\n\t\t}\n\n\t\ta[x-apple-data-detectors=true] {\n\t\t\tcolor: inherit !important;\n\t\t\ttext-decoration: none !important;\n\t\t}\n\t</style>\n\t<style type="text/css" id="media-query">\n\t\t@media (max-width: 640px) {\n\n\t\t\t.block-grid,\n\t\t\t.col {\n\t\t\t\tmin-width: 320px !important;\n\t\t\t\tmax-width: 100% !important;\n\t\t\t\tdisplay: block !important;\n\t\t\t}\n\n\t\t\t.block-grid {\n\t\t\t\twidth: 100% !important;\n\t\t\t}\n\n\t\t\t.col {\n\t\t\t\twidth: 100% !important;\n\t\t\t}\n\n\t\t\t.col>div {\n\t\t\t\tmargin: 0 

*Code sample truncated*

 

Can someone understand what the problem is? 
Let me know if I can provide any additional information. 

Thanks!

1 ACCEPTED SOLUTION
edivodev
Campaign Expert

add this to your header

 

"Content-Type: application/json; charset=utf-8";

 

it worked for us

View solution in original post

10 REPLIES 10
Resources
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up