googleapis / google-api-php-client

A PHP client library for accessing Google APIs
http://googleapis.github.io/google-api-php-client/
Apache License 2.0
9.29k stars 3.52k forks source link

Remains of response properties in DfaReporting service objects? #1312

Closed peterviergutz closed 6 years ago

peterviergutz commented 7 years ago

While switching from v0.11 to v0.27 of the google/apiclient-services (I'm upgrading from v2.7 to v2.8 of the DfaReporting service) I noticed that the returned objects seem to have remains of their response properties in them e.g. the idDimensionValue which is translated to id and the advertiserIdDimensionValue which is translated to advertiserId:

{
    "accountId": "---REMOVED---",
    "advertiserGroupId": null,
    "advertiserId": "---REMOVED---",
    "archived": false,
    "billingInvoiceCode": null,
    "comment": "---REMOVED---",
    "creativeGroupIds": null,
    "endDate": "2016-06-30",
    "externalId": null,
    "id": "---REMOVED---",
    "kind": "dfareporting#campaign",
    "name": "---REMOVED---",
    "nielsenOcrEnabled": false,
    "startDate": "2016-05-30",
    "subaccountId": "---REMOVED---",
    "traffickerEmails": null,
    "idDimensionValue": {
        "dimensionName": "dfa:campaignId",
        "etag": "---REMOVED---",
        "id": null,
        "kind": "dfareporting#dimensionValue",
        "matchType": null,
        "value": "---REMOVED---"
    },
    "advertiserIdDimensionValue": {
        "dimensionName": "dfa:advertiserId",
        "etag": "---REMOVED---",
        "id": null,
        "kind": "dfareporting#dimensionValue",
        "matchType": null,
        "value": "---REMOVED---"
    },
    "clickThroughUrlSuffixProperties": {
        "clickThroughUrlSuffix": null,
        "overrideInheritedSuffix": false
    },
    "defaultClickThroughEventTagProperties": {
        "defaultClickThroughEventTagId": null,
        "overrideInheritedEventTag": false
    },
    "creativeOptimizationConfiguration": {
        "id": "---REMOVED---",
        "name": null,
        "optimizationModel": "CLICK"
    },
    "lookbackConfiguration": {
        "clickDuration": -1,
        "postImpressionActivitiesDuration": -1
    },
    "createInfo": {
        "time": "1464613587668"
    },
    "lastModifiedInfo": {
        "time": "1484982797616"
    },
    "adBlockingConfiguration": {
        "clickThroughUrl": null,
        "creativeBundleId": null,
        "enabled": false,
        "overrideClickThroughUrl": false
    }
}

in v0.11 the resulting objects are much cleaner:

{
    "accountId": "---REMOVED---",
    "advertiserGroupId": null,
    "advertiserId": "---REMOVED---",
    "archived": false,
    "billingInvoiceCode": null,
    "comment": "---REMOVED---n",
    "creativeGroupIds": null,
    "endDate": "2016-06-30",
    "externalId": null,
    "id": "---REMOVED---",
    "kind": "dfareporting#campaign",
    "name": "---REMOVED---",
    "nielsenOcrEnabled": false,
    "startDate": "2016-05-30",
    "subaccountId": "---REMOVED---",
    "traffickerEmails": null
}

Code I'm using:

$campaignSearchCriteria = [
    'maxResults' => 1000,
    'sortField' => 'ID',
    'sortOrder' => 'DESCENDING',
    'advertiserIds' => [$advertiserId],
    'pageToken' => $pageToken,
];

$result = $this->dfaReportingService->campaigns->listCampaigns($this->dfaProfileId, $campaignSearchCriteria);

Installed google libraries:

✗ composer show | grep google
google/apiclient                          v2.2.0             Client library for Google APIs
google/apiclient-services                 v0.27              Client library for Google APIs
google/auth                               v1.0.1             Google Auth Library for PHP
googleads/googleads-php-lib               13.1.0             Google Ads APIs Client Library for PHP (AdWords and DFP)

Is this intentional?

Thank you.

mattwhisenhunt commented 6 years ago

You should be able to use the fields parameter to get a smaller result back.

mattwhisenhunt commented 6 years ago

Thank you for filing this issue. We asked some clarifying questions or suggested a course of action a week or more ago and never heard back from you. We are unable to proceed with this issue until then, so we are closing it. Please feel free to comment with more information and we will re-open this issue.