@JohnDeery opened this Issue on May 2nd 2013

The documentation on the help page for bulk tracking needs to be updated. Currently it says that the request needs to be sent as a json string that looks like this:

{
   "requests": [
      "?idsite=1&url=http://example.org&action_name=Test bulk log Pageview&rec=1",
      "?idsite=1&url=http://example.net/test.htm&action_name=Another bul k page view&rec=1"
   ],
   "token_auth": "33dc3f2536d3025974cccb4b4d2d98f4"
}

However, this was not working. Inspecting a response sent from import_logs.py via Fiddler2, the request that is sent to piwik.php actually looks like this:

{
    "requests": [
        {
            "idsite": "1",
            "url": "http://example.org",
            "action_name": "Test bulk log Pageview&rec=1"
        },
        {
            "idsite": "1",
            "url": "http://example.net/test.htm",
            "action_name": "Anotherbulkpageview",
            "rec": "1"
        }
    ],
    "token_auth": "33dc3f2536d3025974cccb4b4d2d98f4"
}

Keywords: bulk tracking

@JohnDeery commented on May 7th 2013

Attachment:
bad_send.jpg

@JohnDeery commented on May 7th 2013

Attachment:
bad_results.jpg

@JohnDeery commented on May 7th 2013

Attachment:
good_send.jpg

@JohnDeery commented on May 7th 2013

Attachment:
good_results.jpg

@mattab commented on May 5th 2013 Owner

I looked at the code and it should already be working. I suspect it didn't work in your case because, http://example.org should be URL encoded in the string (as well as other parameters).

The API code should work for both Query strings and array of parameters. If you try again with encoded parameters and it still not working for you please post the "CURL" command used to reproduce and I'll look into it!

@JohnDeery commented on May 7th 2013

Nope, it doesn't work. please see the attached... There is a "bad sending", which is the example data that is up on the documentation page, and the results pulled from Fiddler (can't do curl, we're on windows hosting and I'm not going to be able to get the windows version installed), and a "good send" and the results.

@mattab commented on May 7th 2013 Owner

Can you please send the example URLs that does not work in your case, so I can try reproduce the issue?

@JohnDeery commented on May 7th 2013

I'm using the example from the documentation (Found Here): http://example.org

As I said in my initial report, I analyzed what was being sent from import_logs.py to the server and there is no url encoding happening. It's as posted in the original request. The posted data needs to follow that format or else piwik will reject it when going over POST

@mattab commented on May 14th 2013 Owner

I tested the command:

 curl -i -X POST -d '{"requests":[bulk log Pageview&rec=1","?idsite=1&url=http://example.net/test.hr bulk page view&rec=1"]("?idsite=1&url=http://example.org&action_name=Test),"token_auth":"XXXXX"}' http://localhost/piwik/piwik.php ```

and it worked for me (imported the data)
This Issue was closed on May 14th 2013
Powered by GitHub Issue Mirror