Newbie question - passing fields

Skip to first unread message

Jurgen Puype

Nov 8, 2016, 7:02:10 AM11/8/16
to Taffy Users
Hi all,

I just started using Taffy for an new project as mine, and I must say that I'm really impressed with it.

However I was wondering if there is a way to send request arguments in the body of the http call instead of the url?
I have some API-endpoints that take a lot of fields, some optional, so that url would become kind of long and in my personal opinion confusing.


Adam Tuttle

Nov 8, 2016, 9:35:04 AM11/8/16
to Taffy Users

Just as Taffy supports multiple output formats through the use of Serializers, you may use Deserializers to parse post-body data (traditionally only used for POST and PUT requests, though I think Taffy will parse it no matter what verb is used, if you send one).

By default, it is assumed you want to accept JSON input data. If you want to accept anything else, you'll need to write a custom deserializer.

If you send a request like so (line 2 is the body text):

POST /foo/bar
{ "widgets": 4 }

Then the CFC with taffy:uri="/foo/bar" will get its POST method called, with the following argumentCollection: { widgets: 4 }

Sending an object as the body will map the keys in the object to the method arguments. So:

function post( widgets ){ ... }

will be called like this: post( argumentCollection: { widgets: 4 } );

If you want, you can post an array instead of an object as the request body:

POST /foo/bar
[ "a", "b", 42 ]

And the default Deserializer that ships with taffy will send this to your resources as _body (note: still deserialized, not as a string):

post( argumentCollection: { _body: [ "a", "b", 42 ] } );


You received this message because you are subscribed to the Google Groups "Taffy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Reply all
Reply to author
0 new messages