/**
* @return array URL to call the API, eg. "method=Referrers.getKeywords&period=day&date=yesterday"...
*/
public function getRequestArray()
{
// we prepare the array to give to the API Request
// we setup the method and format variable
// - we request the method to call to get this specific DataTable
// - the format = original specifies that we want to get the original DataTable structure itself, not rendered
$requestArray = array('method' => $this->requestConfig->apiMethodToRequestDataTable, 'format' => 'original');
$toSetEventually = array('filter_limit', 'keep_summary_row', 'filter_sort_column', 'filter_sort_order', 'filter_excludelowpop', 'filter_excludelowpop_value', 'filter_column', 'filter_pattern', 'flat', 'expanded', 'pivotBy', 'pivotByColumn', 'pivotByColumnLimit');
foreach ($toSetEventually as $varToSet) {
$value = $this->getDefaultOrCurrent($varToSet);
if (false !== $value) {
$requestArray[$varToSet] = $value;
}
}
$segment = ApiRequest::getRawSegmentFromRequest();
if (!empty($segment)) {
$requestArray['segment'] = $segment;
}
if (ApiRequest::shouldLoadExpanded()) {
$requestArray['expanded'] = 1;
}
$requestArray = array_merge($requestArray, $this->requestConfig->request_parameters_to_modify);
if (!empty($requestArray['filter_limit']) && $requestArray['filter_limit'] === 0) {
unset($requestArray['filter_limit']);
}
if ($this->requestConfig->disable_generic_filters) {
$requestArray['disable_generic_filters'] = '1';
}
if ($this->requestConfig->disable_queued_filters) {
$requestArray['disable_queued_filters'] = 1;
}
return $requestArray;
}