title: Error 400: Bad request while fetching json data from instagram api via coldfusion
body: <p>Afraid to ask this question as I'm not able to create a jsfiddle for it, but hope someone will be able help.</p>
  
  <p>I'm trying to create a cfc in ColdFusion for an instagram login. That part is done. I'm using postman (google app) and by my credentials I can see the user's data in json, but when I'm converting this into ColdFusion it's giving an error. I tried to change the data-type, header and a lot of lines but am still getting the same error again and again.</p>
  
  <p>My code (replaced ids with xxx for security)</p>
  
  <pre><code>&lt;cftry&gt;
  &lt;cfhttp url="https://api.instagram.com/oauth/access_token" method="post" resolveurl="yes"&gt;
      &lt;cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded" /&gt;
      &lt;cfhttpparam type="formfield" name="client_id" value="14faxxxxxdc5440f86x6cdd8xxxxf78" /&gt;
      &lt;cfhttpparam type="formField" name="client_secret" value="40xa78220cfb" /&gt;
      &lt;cfhttpparam type="formField" name="grant_type" value="authorization_code" /&gt;
      &lt;cfhttpparam type="formField" name="redirect_uri" value="#URLEncodedFormat('http://example.com/demo/instagramAPI/success.cfm')#" /&gt;
      &lt;cfhttpparam type="formField" name="code" value="#url.code#" /&gt;
  &lt;/cfhttp&gt;
  &lt;cfdump var="#cfhttp#"&gt;&lt;cfabort&gt;
  &lt;cfcatch type="any"&gt;
  &lt;cfdump var="#cfcatch#"&gt;
  &lt;/cfcatch&gt;
  &lt;/cftry&gt;  
  </code></pre>
  
  <p>I'm following this code from this <a href="https://stackoverflow.com/questions/13138365/curl-call-to-coldfusion-instagram">answer</a>. For more info check this <a href="https://i.stack.imgur.com/62Lcj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/62Lcj.jpg" alt="Image"></a>. You can see that I'm getting data by using the same login details, but when doing the same via a cfc I'm getting error.</p>
  
  <p>Error which I'm getting after running the url : <a href="https://i.stack.imgur.com/OIlxU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OIlxU.jpg" alt="Error"></a></p>
  
  <p>I've read a lot of articles and blogs, but still haven't been able to resolve the error. Can anyone help me understand what I'm doing wrong? If you have any other suggestions, please do let me know.</p>
  
  <p>If any additional information is required, just let me know.</p>