it's sending a json as a post content, not the usual form data that is
automatically parsed.
you'd get automatic request.post_vars reconstruction with json ONLY if they
posted an object, but instead they're posting an array of objects (notice
the [ ] at top and bottom).
web2py (or anything, for that matter) can't build a key-value object (as
the usual request.post_vars) because there are no keys at the top level.
if you want to receive that post, you need to read the request.body() and
parse the json accordingly.
On Monday, March 7, 2016 at 5:51:53 PM UTC+1, Lisandro wrote:
>
> Thanks for the tip.
>
> I've done some tests, and I've found some details that could point the
> problem.
>
> I'm sending a test post to my app url, from SparkPost web app.
> SparkPost tells me that it will send this post:
>
> POST /ws/sparkpost_message_opened HTTP/1.1
> Host: xxxxxxxxx.com.ar
> Content-Type: application/json
> X-MessageSystems-Batch-ID: 77c2b630-d712-11e4-9642-efc2723b99c1
> Connection: close
>
> [
> {
> "msys": {
> "track_event": {
> "type": "open",
> "campaign_id": "Example Campaign Name",
> "customer_id": "1",
> "delv_method": "esmtp",
> "event_id": "92356927693813856",
> "ip_address": "127.0.0.1",
> "message_id": "0e0d94b7-9085-4e3c-ab30-e3f2cd9c273e",
> "rcpt_meta": {
> "customKey": "customValue"
> },
> "rcpt_tags": [
> "male",
> "US"
> ],
> "rcpt_to": "[email protected] <javascript:>",
> "raw_rcpt_to": "[email protected] <javascript:>",
> "rcpt_type": "cc",
> "subaccount_id": "101",
> "template_id": "templ-1234",
> "template_version": "1",
> "timestamp": 1454442600,
> "transmission_id": "65832150921904138",
> "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3)
> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36"
> ,
> "geo_ip": {
> "country": "US",
> "region": "MD",
> "city": "Columbia",
> "latitude": "39.1749",
> "longitude": "-76.8375"
> }
> }
> }
> }
> ]
>
>
> I've modified my nginx log configuration, to log the $request_body to a
> log file, and I can see in deed the post (sorry about the format, but you
> can see the post data is there):
>
> [{\x22msys\x22:{\x22track_event\x22:{\x22type\x22:\x22open\x22,\
> x22campaign_id\x22:\x22Example Campaign Name\x22,\x22customer_id\x22:\x221
> \x22,\x22delv_method\x22:\x22esmtp\x22,\x22event_id\x22:\
> x2292356927693813856\x22,\x22ip_address\x22:\x22127.0.0.1\x22,\
> x22message_id\x22:\x220e0d94b7-9085-4e3c-ab30-e3f2cd9c273e\x22,\
> x22rcpt_meta\x22:{\x22customKey\x22:\x22customValue\x22},\x22rcpt_tags\x22
> :[\x22male\x22,\x22US\x22],\x22rcpt_to\x22:\[email protected]\x22,\
> x22raw_rcpt_to\x22:\[email protected]\x22,\x22rcpt_type\x22:\x22cc\
> x22,\x22subaccount_id\x22:\x22101\x22,\x22template_id\x22:\x22templ-1234\
> x22,\
> ...
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.