Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING API change: Format of data returned in "Bulk request" mode has changed #3940

Closed
tsteur opened this issue May 18, 2013 · 4 comments
Closed
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented May 18, 2013

NOTE: the code is API BREAKING only if you were early user of this feature. Please check the client code as of 1.12-b16 to make sure it works well.

Hi,

wanted to integrate the new Dashboards API into Piwik Mobile by using API.getBulkRequest method.

Unfortunately, the return JSON of API.getReportMetadata seems to be invalid. Getting an error when trying to parse JSON in Browser as well as on Mobile Devices. Would be nice to have this fixed in Piwik 1.12 otherwise Dashboards won't work in Mobile App.

Example Request:
http://demo.piwik.org/index.php?urls%5B0%5D=method%3dAPI.getReportMetadata%26hideMetricsDoc%3d1%26showSubtableReports%3d0%26format%3dJSON%26idSites%3d7%26&urls%5B1%5D=method%3dDashboard.getDashboards%26format%3dJSON%26idSite%3d7%26&idSite=7&module=API&date=today&token_auth=anonymous&period=day&format=json&method=API.getBulkRequest&language=en&

To reproduce simply goto http://jsfiddle.net/5PPxD/ , press Run and watch console.
You will see the following error message:

Uncaught SyntaxError: Unexpected token S.

Looks like the problem is caused by a documentation 'See the "Search Engines & Keywords" report for more '... Just use http://json.parser.online.fr/ to validate the JSON.

@mattab
Copy link
Member

mattab commented May 23, 2013

In debae07: Fixes #3940 Adding '&format=php' to ensure the data within the bulk request, is converted only once and is valid JSON. Also works in XML (not in CSV).

I updated the bulk request doc at: http://piwik.org/docs/analytics-api/reference/#toc-advanced-users-send-multiple-api-requests-at-once

@mattab
Copy link
Member

mattab commented May 23, 2013

@thomas, can you confirm if you were using BULK Requests already in Piwik Mobile? I'm worried maybe my change would break something in existing users?

@mattab
Copy link
Member

mattab commented May 23, 2013

the new version is deployed on demo so please test, thanks!

@tsteur
Copy link
Member Author

tsteur commented May 23, 2013

thanks a lot! it works

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

2 participants