OK, answering my own question here but with some help I figured out what
was wrong. In my curl POST, instead of:
curl -X POST -H "Content-Type: application/json" -d
'{"username":"admin","api_key":"000000","hash_id":"90308764807aae"}'
http://0.0.0.0:6543/api/v1/a/bmark/publish
I should have done:
curl --data "username=admin&api_key=000000&hash_id=90308764807aae"
http://0.0.0.0:6543/api/v1/a/bmark/publish
pyramid will fill request.params with the & token. If I wanted to use the
former curl call, I would have to use request.json_body
The jQuery should NOT JSON.Stringify() the POST data. Also, if you want to
use request.params, don't send `contentType: "application/json;
charset=utf-8"`. My guess is that I could leave it in there if I were to
access request.json_body but I'm not exploring that option at this point.
On Sat, Feb 1, 2014 at 12:06 AM, Mazzaroth M. <[email protected]> wrote:
> Hi all,
>
> I've got a pyramid app that's loosely based upon Bookie:
>
> https://github.com/bookieio/Bookie
>
> Anyway, when I set up a route in my api.py file to accept a POST request,
> when I print out the request.params it is empty [()]. I've attempted a POST
> via both curl and jquery ajax/xhr and for some reason once it hits the
> server there doesn't appear to be any params.
>
> The code and output is at this paste bin:
>
> http://pastebin.com/97CgjLdH
>
> Also, strangely, the ajax POST call will bypass security even though the
> api_key param is None, while the call via curl will not.
>
> Any suggestions would be appreciated.
>
> regards,
> Michael
>
>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.