Skip to main content
March 27, 2014
Answered

cfhttpparam question - passing formfield name as an array

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")

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Correct answer
    March 27, 2014

    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.

    1 reply

    Correct answer
    March 27, 2014

    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.

    Translate