1 Reply Latest reply on Mar 27, 2014 2:15 PM by redherring917

    cfhttpparam question - passing formfield name as an array

    redherring917

      Hi.  I'm using cfhttp to post data to an API.  An example of one of the parameters required as input by that API is "subscription[planId]".  Question is, how in the world to I pass a sort of "named array" like this where "planId" isn't a variable, it's text.  I apologize that clearly I'm missing something pretty basic here, but... I'm sure missing it. 

       

      Thanks.

       

      P.S.  In case it lends any insight at all, here's a snippet of sample PHP code that is supposed to do this (I cannot confirm, not being a PHP guy):

       

      "subscription" => array("planId" => "1")

        • 1. Re: cfhttpparam question - passing formfield name as an array
          redherring917 Level 1

          Turns out I was making a silly mistake.  I knew that would be the case - I just had to keep fighting until I found the silly mistake.  (And of course during the course of fighting one makes all kinds of changes that only complicate things.)

           

          In my case, somewhere along the way I included a cfhttpparam of <cfhttpparam type="header" name="Content-Type" value="application/json" />, at a time when I thought that I could pass JSON as type "body".  When I went back to passing formfields, I neglected to remove this. 

           

          Always something silly.

           

          Thanks.