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

Make API\Request also accept named array parameters #4003

Open
anonymous-matomo-user opened this issue Jun 12, 2013 · 0 comments
Open

Make API\Request also accept named array parameters #4003

anonymous-matomo-user opened this issue Jun 12, 2013 · 0 comments
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.

Comments

@anonymous-matomo-user
Copy link

Since the last version, I discovered a problem with API.

If I use:

$url = "http://www.domain.com/;
$url .= "?module=API&method=PDFReports.addReport";
$url .= "&idSite=1&description=Rapport&period=never&hour=0";
$url .= "&reportType=email&reportFormat=pdf";
$url .= "&reports[]=" . implode('&reports[]=',$types[$type]['reports']);
$url .= "&parameters[displayFormat]=" . $types[$type]['parameters']['displayFormat'];
$url .= "&parameters[emailMe]=" . $types[$type]['parameters']['emailMe'];
$url .= "&parameters[evolutionGraph]=" . $types[$type]['parameters']['evolutionGraph'];
$url .= "&format=JSON";
$url .= "&token_auth=" . ADMIN_TOKEN_AUTH;
$r= new Piwik_API_Request($url);
$request = $r->process();
print_r($request);

Result:

{"result":"error", "message":"Please specify a value for 'parameters'."}

If I use:

$url = "http://www.domain.com/";
$url .= "?module=API&method=PDFReports.addReport";
$url .= "&idSite=1&description=Rapport&period=never&hour=0";
$url .= "&reportType=email&reportFormat=pdf";
$url .= "&reports[]=" . implode('&reports[]=',$types[$type]['reports']);
$url .= "&parameters[displayFormat]=" . $types[$type]['parameters']['displayFormat'];
$url .= "&parameters[emailMe]=" . $types[$type]['parameters']['emailMe'];
$url .= "&parameters[evolutionGraph]=" . $types[$type]['parameters']['evolutionGraph'];
$url .= "&format=JSON";
$url .= "&token_auth=" . ADMIN_TOKEN_AUTH;
$request = json_decode(file_get_contents($url),true);
print_r($request);

Result:

Array
(
[value] => 12
)

@anonymous-matomo-user anonymous-matomo-user added this to the 2.x - The Great Piwik 2.x Backlog milestone Jul 8, 2014
@mattab mattab removed P: low labels Aug 3, 2014
@mattab mattab modified the milestones: Mid term, Long term Oct 11, 2014
@mattab mattab modified the milestones: Long term, Mid term Dec 23, 2015
@mattab mattab modified the milestones: Long term, Mid term Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

No branches or pull requests

2 participants