<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Getting 400 Bad Request when trying to add a Blog Post in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/306850#M29090</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/112966"&gt;@romaindalichamp&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When looking at TRY 1 and TRY 2, I noticed something different in the way you set the POST body to JSON. For TRY 1, you aint' using the toJson() method whereas for TRY 2 you're using the to.Json() method.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Curious to know if there are any differences between the way you convert contactSendList and blogpostSendPost to JSON?&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2019 01:30:05 GMT</pubDate>
    <dc:creator>WendyGoh</dc:creator>
    <dc:date>2019-12-11T01:30:05Z</dc:date>
    <item>
      <title>Getting 400 Bad Request when trying to add a Blog Post</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/306532#M29045</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi guys,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;i have some trouble trying to create&lt;A href="https://developers.hubspot.com/docs/methods/blogv2/post_blog_posts" target="_self"&gt; Blog Posts,&lt;/A&gt; i would like to receive a JSON response, but i have a 400 Bad Request error.&lt;BR /&gt;&lt;BR /&gt;I've done the same code with Contact model, using the v1 of HubSpot API and it is working well. The same code for Blog Posts doesn't go through and i don't understand why&lt;BR /&gt;&lt;BR /&gt;i am using Java 8 and RestTemplate.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;U&gt;So, with &lt;STRONG&gt;Postman &lt;/STRONG&gt;straight to the HubSpotAPI&amp;nbsp;and the following datas&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#008000"&gt;it works&lt;/FONT&gt;&lt;/STRONG&gt;:&lt;/U&gt;&lt;BR /&gt;&lt;STRONG&gt;URL:&lt;/STRONG&gt; &lt;A href="https://api.hubapi.com/content/api/v2/blog-posts?hapikey=*****************" target="_blank" rel="noopener"&gt;https://api.hubapi.com/content/api/v2/blog-posts?hapikey=*****************&lt;/A&gt;&lt;BR /&gt;&lt;STRONG&gt;Header&lt;/STRONG&gt;: Content-Type: application/json&lt;BR /&gt;&lt;STRONG&gt;Body&lt;/STRONG&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{
"name": "My first API blog post!",
"content_group_id": 351076997
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;==&amp;gt; &lt;STRONG&gt;Here is the Response&lt;/STRONG&gt;, nice:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"correlationId":&amp;nbsp;"************************",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"errorType":&amp;nbsp;"PARENT_BLOG_DOES_NOT_EXIST",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"message":&amp;nbsp;"Selected&amp;nbsp;parent&amp;nbsp;blog&amp;nbsp;doesn't&amp;nbsp;exist",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"requestId":&amp;nbsp;"************************",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"status":&amp;nbsp;"error"
}&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;Now, when i am using Java to create the request&lt;BR /&gt;&lt;BR /&gt;&lt;U&gt;Through &lt;STRONG&gt;my service&lt;/STRONG&gt;, &lt;STRONG&gt;&lt;FONT color="#800000"&gt;it doesn't works&lt;/FONT&gt;&lt;/STRONG&gt;:&lt;/U&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;URL:&lt;/STRONG&gt; http://localhost:8888/hubspot/blogposts?hapikey=************************&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;Headers &amp;amp; Request&lt;/STRONG&gt;:&lt;BR /&gt;&lt;/SPAN&gt;&lt;PRE&gt;&lt;SPAN&gt;// Header and content declarations&lt;BR /&gt;&lt;/SPAN&gt;HttpHeaders headers = &lt;SPAN&gt;new &lt;/SPAN&gt;HttpHeaders()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;headers.setContentType(MediaType.&lt;SPAN&gt;APPLICATION_JSON&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;HttpEntity&amp;lt;BlogpostSendPost&amp;gt; request = &lt;SPAN&gt;new &lt;/SPAN&gt;HttpEntity&amp;lt;&amp;gt;(blogpostSendPost&lt;SPAN&gt;, &lt;/SPAN&gt;headers)&lt;SPAN&gt;;&lt;BR /&gt;// Tried also&lt;BR /&gt;// HttpEntity&amp;lt;String&amp;gt; request = new HttpEntity&amp;lt;&amp;gt;(blogpostSendPost.toJson(), headers);&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In my Java code, i am calling the API in this way (Object type, is for dev needs)&lt;BR /&gt;&lt;/SPAN&gt;&lt;PRE&gt;Object answer = &lt;SPAN&gt;restTemplate&lt;BR /&gt;&lt;/SPAN&gt;            .postForObject(&lt;SPAN&gt;"https://api.hubapi.com/content/api/v2/blog-posts?hapikey=****************"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;request&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                    Object.&lt;SPAN&gt;class&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;SPAN&gt;==&amp;gt; &lt;STRONG&gt;Here is the Reponse, why ?&lt;/STRONG&gt;:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"timestamp":&amp;nbsp;"2019-12-09T19:10:01.981+0000",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"status":&amp;nbsp;500,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"error":&amp;nbsp;"Internal&amp;nbsp;Server&amp;nbsp;Error",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"message":&amp;nbsp;"400&amp;nbsp;Bad&amp;nbsp;Request",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"trace":&amp;nbsp;"org.springframework.web.client.HttpClientErrorException$BadRequest:&amp;nbsp;400&amp;nbsp;Bad&amp;nbsp;Request\r\n\tat&amp;nbsp;
.........
}&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I have read the other posts about the header like this one:&lt;BR /&gt;&lt;A href="https://community.hubspot.com/t5/APIs-Integrations/Getting-a-400-Bad-Request-when-trying-to-create-a-deal/m-p/266569" target="_blank" rel="noopener"&gt;https://community.hubspot.com/t5/APIs-Integrations/Getting-a-400-Bad-Request-when-trying-to-create-a-deal/m-p/266569&lt;/A&gt;&lt;BR /&gt;Is there anything in the API v2 changing the way to receive the JSON body, i should add to my code to make it works ?&lt;BR /&gt;&lt;BR /&gt;Thank you for your help &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Romain&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 09 Dec 2019 19:50:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/306532#M29045</guid>
      <dc:creator>romaindalichamp</dc:creator>
      <dc:date>2019-12-09T19:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 400 Bad Request when trying to add a Blog Post</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/306591#M29058</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/112966"&gt;@romaindalichamp&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on my research, it appears that this error is because of wrong headers or wrong request body. Looking at the header it looks fine. One thing that I noticed though is that the code didn't include the HTTP method POST. Could we try that out and see if it works?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reference this discussion here:&amp;nbsp;&lt;A href="https://www.concretepage.com/questions/517" target="_blank"&gt;https://www.concretepage.com/questions/517&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 03:28:59 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/306591#M29058</guid>
      <dc:creator>WendyGoh</dc:creator>
      <dc:date>2019-12-10T03:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 400 Bad Request when trying to add a Blog Post</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/306710#M29069</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;SPAN&gt;WendyGoh,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your anwser.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am already using "&lt;A href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html#postForObject-java.net.URI-java.lang.Object-java.lang.Class-" target="_self"&gt;PostForObject&lt;/A&gt;" from the class RestTemplate for POST requests, but just to be sure, i changed&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;my code with the following lines, but i still have the same response 400:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;Object answer = &lt;SPAN&gt;restTemplate&lt;/SPAN&gt;.exchange(&lt;BR /&gt;        &lt;SPAN&gt;"https://api.hubapi.com/content/api/v2/blog-posts?hapikey=**********"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        HttpMethod.&lt;SPAN&gt;POST&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        request&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        Object.&lt;SPAN&gt;class&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;The body i am using is the example from here:&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/methods/blogv2/post_blog_posts" target="_blank" rel="noopener"&gt;https://developers.hubspot.com/docs/methods/blogv2/post_blog_posts&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So i guess, my problem should com from the header ...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is exactly what is send when i log the request, a step before the action:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt; &amp;lt;{"name":"My first API blog post!","content_group_id":"351076997"},[Content-Type:"application/json"]&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;i am trying to check if &lt;A href="https://community.hubspot.com/t5/APIs-Integrations/Getting-a-400-Bad-Request-when-trying-to-create-a-deal/m-p/267315/highlight/true#M24009" target="_self"&gt;the solution of&amp;nbsp;ivandhalluin&lt;/A&gt; can work in my case, but i don't see how to do that ...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 15:18:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/306710#M29069</guid>
      <dc:creator>romaindalichamp</dc:creator>
      <dc:date>2019-12-10T15:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 400 Bad Request when trying to add a Blog Post</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/306727#M29074</link>
      <description>&lt;P&gt;Ok, i found out a way to make it work but it seems something is going wrong, i have the same parameters &amp;amp; values for this cases:&lt;/P&gt;&lt;P&gt;- Contacts + HubSpot API v1 + RestTemplate ==&amp;gt; Post Request = OK&lt;/P&gt;&lt;P&gt;- Blog Post + HubSpot API v2 + RestTemplate ==&amp;gt; Post Request = NOK&lt;/P&gt;&lt;P&gt;- Blog Post + HubSpot API v2 + UniRest ==&amp;gt; Post Request = OK&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you think ? is the header formatted differently in an incompatible way with RestTemplate and your API v2 ?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Check theses samples:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;.info(&lt;SPAN&gt;"=====RestTemplate==================================================="&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;// Header and content declarations&lt;BR /&gt;&lt;/SPAN&gt;HttpHeaders headers = &lt;SPAN&gt;new &lt;/SPAN&gt;HttpHeaders()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;headers.setContentType(MediaType.&lt;SPAN&gt;APPLICATION_JSON&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;// TRY 1: CONTACTS - RestTemplate - OK - contact is created (API V1)&lt;BR /&gt;&lt;/SPAN&gt;HttpEntity&amp;lt;ContactSendList&amp;gt; request1 = &lt;SPAN&gt;new &lt;/SPAN&gt;HttpEntity&amp;lt;&amp;gt;(contactSendList&lt;SPAN&gt;, &lt;/SPAN&gt;headers)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;ContactResponseInformations answer1 = &lt;SPAN&gt;restTemplate&lt;BR /&gt;&lt;/SPAN&gt;        .postForObject(&lt;BR /&gt;                HubSpotConfiguration.&lt;SPAN&gt;URL_CREATE_CONTACT&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;// https://api.hubapi.com/content/api/v2/blog-posts?hapikey=*************&lt;BR /&gt;&lt;/SPAN&gt;                request1&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                ContactResponseInformations.&lt;SPAN&gt;class&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;.info(answer1.toString())&lt;SPAN&gt;;  &lt;/SPAN&gt;&lt;SPAN&gt;// OK&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;// TRY 2: BLOG POSTS - RestTemplate - 400 Bad Request&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;// "Object", is just for sample&lt;BR /&gt;&lt;/SPAN&gt;HttpEntity&amp;lt;String&amp;gt; request2 = &lt;SPAN&gt;new &lt;/SPAN&gt;HttpEntity&amp;lt;&amp;gt;(blogpostSendPost.toJson()&lt;SPAN&gt;,&lt;/SPAN&gt;headers)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;Object answer2 = &lt;SPAN&gt;restTemplate&lt;BR /&gt;&lt;/SPAN&gt;        .postForObject(&lt;BR /&gt;                HubSpotConfiguration.&lt;SPAN&gt;URL_CREATE_BLOGPOST&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;// https://api.hubapi.com/content/api/v2/blog-posts?hapikey=*************&lt;BR /&gt;&lt;/SPAN&gt;                request2&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                Object.&lt;SPAN&gt;class&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;.info(answer2.toString())&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN&gt;// 400 Bad Request&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;// TRY 3: BLOG POSTS - RestTemplate - 400 Bad Request&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;// "Object", is just for sample&lt;BR /&gt;&lt;/SPAN&gt;HttpEntity&amp;lt;String&amp;gt; request3 = &lt;SPAN&gt;new &lt;/SPAN&gt;HttpEntity&amp;lt;&amp;gt;(blogpostSendPost.toJson()&lt;SPAN&gt;,&lt;/SPAN&gt;headers)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;Object answer3 = &lt;SPAN&gt;restTemplate&lt;/SPAN&gt;.exchange(&lt;BR /&gt;        HubSpotConfiguration.&lt;SPAN&gt;URL_CREATE_BLOGPOST&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;// https://api.hubapi.com/content/api/v2/blog-posts?hapikey=*************&lt;BR /&gt;&lt;/SPAN&gt;        HttpMethod.&lt;SPAN&gt;POST&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        request3&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        Object.&lt;SPAN&gt;class&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;.info(answer3.toString())&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN&gt;// 400 Bad Request&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;.info(&lt;SPAN&gt;"=====UNIREST==================================================="&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;// TRY 4: BLOG POSTS - UNIREST - OK&lt;BR /&gt;&lt;/SPAN&gt;HttpResponse&amp;lt;JsonNode&amp;gt; resp = Unirest&lt;BR /&gt;        .&lt;SPAN&gt;post&lt;/SPAN&gt;(HubSpotConfiguration.&lt;SPAN&gt;URL_CREATE_BLOGPOST&lt;/SPAN&gt;) &lt;SPAN&gt;// https://api.hubapi.com/content/api/v2/blog-posts?hapikey=*************&lt;BR /&gt;&lt;/SPAN&gt;        .header(&lt;SPAN&gt;"Content-Type"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"application/json"&lt;/SPAN&gt;)&lt;BR /&gt;        .body(blogpostSendPost)&lt;BR /&gt;        .asJson()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;.info(resp.getBody().getObject().toString())&lt;SPAN&gt;;  &lt;/SPAN&gt;&lt;SPAN&gt;// OK&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thank you for your help !&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 16:32:12 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/306727#M29074</guid>
      <dc:creator>romaindalichamp</dc:creator>
      <dc:date>2019-12-10T16:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 400 Bad Request when trying to add a Blog Post</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/306850#M29090</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/112966"&gt;@romaindalichamp&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When looking at TRY 1 and TRY 2, I noticed something different in the way you set the POST body to JSON. For TRY 1, you aint' using the toJson() method whereas for TRY 2 you're using the to.Json() method.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Curious to know if there are any differences between the way you convert contactSendList and blogpostSendPost to JSON?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 01:30:05 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/306850#M29090</guid>
      <dc:creator>WendyGoh</dc:creator>
      <dc:date>2019-12-11T01:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 400 Bad Request when trying to add a Blog Post</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/307024#M29113</link>
      <description>&lt;P&gt;Hi WendiGoh,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank your for your anwser.&lt;/P&gt;&lt;P&gt;Theses toJson(). are totally the same code and optionals.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This line can be replace:&lt;/P&gt;&lt;PRE&gt;HttpEntity&amp;lt;String&amp;gt; request2 = new HttpEntity&amp;lt;&amp;gt;(blogpostSendPost.toJson(), headers);&lt;BR /&gt;log(request2.toString()); //&amp;lt;{"name":"My first API blog post!","content_group_id":"351076997"},[Content-Type:"application/json"]&amp;gt;&lt;/PRE&gt;&lt;P&gt;with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;HttpEntity&amp;lt;BlogpostSendPost&amp;gt; request2 = new HttpEntity&amp;lt;&amp;gt;(blogpostSendPost, headers);&lt;BR /&gt;log(request2.toString()); //&amp;lt;BlogpostSendPost(name=My first API blog post!, content_group_id=351076997),[Content-Type:"application/json"]&amp;gt;&lt;/PRE&gt;&lt;P&gt;and it change nothing to the response i get from the API (OK ou 400 depending on the 4 Try)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 15:52:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/307024#M29113</guid>
      <dc:creator>romaindalichamp</dc:creator>
      <dc:date>2019-12-11T15:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 400 Bad Request when trying to add a Blog Post</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/307809#M29211</link>
      <description>&lt;P&gt;Hi Wendy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i still have the problem, did you find any informations about that topic ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Romain&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:39:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Getting-400-Bad-Request-when-trying-to-add-a-Blog-Post/m-p/307809#M29211</guid>
      <dc:creator>romaindalichamp</dc:creator>
      <dc:date>2019-12-16T16:39:43Z</dc:date>
    </item>
  </channel>
</rss>

