I am struggling to find enough info to be able to successfully add a scheduled report. The documentation for ScheduledReports.addReport has no examples.
In my test script, that I got working as the example PHP to fetch keywords , I adapted sing the spec for ScheduledReports.addReport and looking at data (API key etc removed) I created the script below, but it doesn’t do anything.
I drove my argument data from what IO could see in the database ‘report’ table but I am pretty much guessing how the two query strings for
reports and parameters might be formatted.
For reports I saw in the API documentation arrays as query string parameters, so used report etc, but for parameters I am guessing.
So can anyone with some experience of this give me a pointer. Thanks
(script below has had API / domain / email removed of course to protect the innocent)
<?php $token_auth = 'my real token'; //ScheduledReports.addReport (idSite, description, period, hour, reportType, reportFormat, reports, parameters, idSegment = '') $url = "http://my analytics domain/"; $url .= "?module=API&method=ScheduledReports.addReport"; $url .= "&idSite=2&period=day&hour=0"; $url .= "&reportType=email"; $url .= "&reportFormat=html"; $url .= "&reports=VisitsSummary_get"; $url .= "&reports=Actions_getEntryPageUrls"; $url .= "¶meters[additionalEmails]=firstname.lastname@example.org"; $url .= "¶meters[emailMe]=true"; $url .= "¶meters[displayFormat]=3"; $url .= "&token_auth=$token_auth"; $fetched = file_get_contents($url); print_r ($fetched); ?>