Unsupported operand types error while updating keyword cpc bid

28 views
Skip to first unread message

Sabri Karagönen

unread,
Aug 10, 2015, 4:54:36 PM8/10/15
to AdWords API Forum
Hi,

I want to update a bulk of keywords in a mutate.

My code is like,

                define("MICROS_PER_DOLLAR", 1000000);

                // Create criterion using an existing ID. Use the base class Criterion
                // instead of Keyword to avoid having to set keyword-specific fields.
                $adGroupCriterion->criterion = new Criterion($keywordID);
                
                // Update the bid.
                $bid = new CpcBid();
                $bid->bid = new Money($teklif * MICROS_PER_DOLLAR);
                $biddingStrategyConfiguration = new BiddingStrategyConfiguration();
                
                $biddingStrategyConfiguration->bids[] = $bid;
                $adGroupCriterion->biddingStrategyConfiguration = $biddingStrategyConfiguration;
                
                $operation = new AdGroupCriterionOperation();
                $operation->operand = $adGroupCriterion;
                $operation->operator = 'SET';
                $operations[] = $operation;

                $result = $adGroupCriteriaService->mutate($operations);


When I run this code, I get "Unsupported operand types" in the line I paint red. 
What am I doing wrong?

Anthony Madrigal

unread,
Aug 11, 2015, 9:18:35 AM8/11/15
to AdWords API Forum
Hi Sabri,

Money is of type long. When defining money values, you need to append an "L" at the end of your value. Once you change 1000000 to 1000000L, your code should not give you that error.

Cheers,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages