Opened 13 months ago

Closed 12 months ago

Last modified 12 months ago

#3868 closed Bug (fixed)

Problem with showColumns for API.get method

Reported by: mauser Owned by: diosmosis
Priority: major Milestone: 1.12 - The Great 1.x Backlog
Component: Core Keywords:
Cc: Sensitive: no

Description

The problem is when specifying showColumns parameter to API.get method.

e.g.

http://demo.piwik.org/index.php?module=API&method=API.get&showColumns=nb_uniq_visitors,nb_pageviews,bounce_rate&idSite=7&period=day&date=2013-04-03&format=JSON

Trace:

<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'>
	    <strong>There is an error. Please report the message (Piwik 1.12-b4)
	    and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).<br /><br/>
	    Notice:</strong> <i>Undefined index: metrics</i> in <b>/home/piwik-demo/www/demo.piwik.org/plugins/API/API.php</b> on line <b>1063</b>
<br /><br />Backtrace --&gt;<div style="font-family:Courier;font-size:10pt"><br />
#0  Piwik_ErrorHandler(...) called at [/home/piwik-demo/www/demo.piwik.org/plugins/API/API.php:1063]<br />
#1  Piwik_API_API-&gt;get(...) called at [:]<br />
#2  call_user_func_array(...) called at [/home/piwik-demo/www/demo.piwik.org/core/API/Proxy.php:187]<br />
#3  Piwik_API_Proxy-&gt;call(...) called at [/home/piwik-demo/www/demo.piwik.org/core/API/Request.php:121]<br />
#4  Piwik_API_Request-&gt;process(...) called at [/home/piwik-demo/www/demo.piwik.org/plugins/API/Controller.php:25]<br />
#5  Piwik_API_Controller-&gt;index(...) called at [:]<br />
#6  call_user_func_array(...) called at [/home/piwik-demo/www/demo.piwik.org/core/FrontController.php:125]<br />
#7  Piwik_FrontController-&gt;dispatch(...) called at [/home/piwik-demo/www/demo.piwik.org/index.php:47]</div><br />
 </pre></div><br />
<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'>
	    <strong>There is an error. Please report the message (Piwik 1.12-b4)
	    and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).<br /><br/>
	    Warning:</strong> <i>Invalid argument supplied for foreach()</i> in <b>/home/piwik-demo/www/demo.piwik.org/plugins/API/API.php</b> on line <b>1063</b>
<br /><br />Backtrace --&gt;<div style="font-family:Courier;font-size:10pt"><br />
#0  Piwik_ErrorHandler(...) called at [/home/piwik-demo/www/demo.piwik.org/plugins/API/API.php:1063]<br />
#1  Piwik_API_API-&gt;get(...) called at [:]<br />
#2  call_user_func_array(...) called at [/home/piwik-demo/www/demo.piwik.org/core/API/Proxy.php:187]<br />
#3  Piwik_API_Proxy-&gt;call(...) called at [/home/piwik-demo/www/demo.piwik.org/core/API/Request.php:121]<br />
#4  Piwik_API_Request-&gt;process(...) called at [/home/piwik-demo/www/demo.piwik.org/plugins/API/Controller.php:25]<br />
#5  Piwik_API_Controller-&gt;index(...) called at [:]<br />
#6  call_user_func_array(...) called at [/home/piwik-demo/www/demo.piwik.org/core/FrontController.php:125]<br />
#7  Piwik_FrontController-&gt;dispatch(...) called at [/home/piwik-demo/www/demo.piwik.org/index.php:47]</div><br />
 </pre></div><br />{"nb_uniq_visitors":813,"nb_pageviews":1743}

Change History (2)

comment:1 Changed 12 months ago by capedfuzz (diosmosis)

  • Owner set to diosmosis
  • Resolution set to fixed
  • Status changed from new to closed

In 08cfe92f278e987fb43ca6584b1822d61774dceb:

Fixes #3868, make sure show/hideColumns query params affect metrics when report metadata doesn't provide a translation for metrics, and make sure if no columns are displayed for a report, API.get doesn't fail.

comment:2 Changed 12 months ago by pwod_

I am also having this problem.

Note: See TracTickets for help on using tickets.