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

Method: advertisers.creatives.list > filter > lineItemIds does not filter #5761

Open
tanghoong opened this issue Oct 24, 2024 · 0 comments
Open

Comments

@tanghoong
Copy link

Environment details

  • OS: WINDOW 11
  • PHP version: 8.3
  • Package name and version: "google/apiclient": "^2.18"

Steps to reproduce

I am working on the filter the AdvertiserCreatives by lineitem, creative listing can be fetch if no passing any filter, but when filter by lineitem, it return nothing.

My testing campaign lineitem confirm have one creative.
I testing filter with 'filter' => "creativeType="CREATIVE_TYPE_STANDARD"" can return no issue.
But 'filter' => "lineItemIds:"$lineItemId"", does not return creatives.

Code example

function getCreatives($service, $advertiserId, $lineItemId) {
    $creatives = [];
    $nextPageToken = null;
    do {
        try {
            $response = $service->advertisers_creatives->listAdvertisersCreatives($advertiserId, [
                'filter' => "lineItemIds:\"$lineItemId\""
            ]);
            $allCreatives = $response->getCreatives();
            foreach ($allCreatives as $creative) {
                $creatives[] = $creative;
            }
            $nextPageToken = $response->getNextPageToken();
        } catch (Exception $e) {
            error_log('Error fetching creatives: ' . $e->getMessage());
            break;
        }
    } while ($nextPageToken);
    return $creatives;
}

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant