AdWords API Re: Displaying updated adgroup CPC

2010-02-22 Thread Mike-Indiana
Thanks for your help Eric,

I switched from ApiAbility and I'm trying to get this all figured out.

Mike

On Feb 22, 11:25 am, AdWords API Advisor
 wrote:
> Hi,
>
> The bid is a complex object, if you want the numerical money value
> inside it you need to unwrap the object, the same way you built it:
>
>   $value = $adGroup->bids->keywordMaxCpc->amount->microAmount;
>
> The AdWords API developer documentation shows these field names and
> their types:
>
>  http://code.google.com/apis/adwords/v2009/docs/reference/AdGroupCrite...
>
> Best,
> - Eric
>
> On Feb 19, 4:44 pm, Mike-Indiana  wrote:
>
> > Hi Eric,
>
> > Thanks for the reply. I'm running into this error:
> > Catchable fatal error: Object of class Bid could not be converted to
> > string
>
> > On Feb 18, 9:37 am, AdWords API Advisor 
> > wrote:
>
> > > Hi,
>
> > > You need to retrieve the value the same way you are setting it.  In
> > > this case your code should be:
>
> > >   $newstatus = $adGroup->bids->keywordMaxCpc;
>
> > > Best,
> > > - Eric Koleda, AdWords API Team
>
> > > On Feb 17, 5:52 pm, "michaelyanda+...@gmail.com" 
> > > +...@gmail.com> wrote:
> > > > Hi, updating an adgroup CPC is completed smoothly, however I am having
> > > > problems printing the value.
>
> > > > In PHP, my code is: (Please see $newstatus = $adGroup->keywordMaxCpc;)
>
> > > >         // Adjust bid to micro format
> > > >         $agcpcG = ($cpc * 100);
>
> > > >         // Create ad group bid.
> > > >         $adGroupBids = new ManualCPCAdGroupBids();
> > > >         $adGroupBids->keywordMaxCpc = new Bid(new Money($agcpcG));
> > > >         $adGroup->bids = $adGroupBids;
>
> > > >         // Create operations.
> > > >         $operation = new AdGroupOperation();
> > > >         $operation->operand = $adGroup;
> > > >         $operation->operator = 'SET';
>
> > > >         $operations = array($operation);
>
> > > >         // Update ad group.
> > > >         $result = $adGroupService->mutate($operations);
>
> > > >         // Display status
> > > >                 if (isset($result->value)) {
> > > >                         foreach ($result->value as $adGroup) {
> > > >                         $newstatus = $adGroup->keywordMaxCpc;
> > > >                         }
> > > >                 }
> > > >                 else {
> > > >                 $newstatus = "Error";
> > > >                 }
>
> > > > Many thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To post to this group, send email to adwords-...@googlegroups.com.
To unsubscribe from this group, send email to 
adwords-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/adwords-api?hl=en.



AdWords API Re: Displaying updated adgroup CPC

2010-02-22 Thread AdWords API Advisor
Hi,

The bid is a complex object, if you want the numerical money value
inside it you need to unwrap the object, the same way you built it:

  $value = $adGroup->bids->keywordMaxCpc->amount->microAmount;

The AdWords API developer documentation shows these field names and
their types:

  
http://code.google.com/apis/adwords/v2009/docs/reference/AdGroupCriterionService.ManualCPCAdGroupCriterionBids.html

Best,
- Eric

On Feb 19, 4:44 pm, Mike-Indiana  wrote:
> Hi Eric,
>
> Thanks for the reply. I'm running into this error:
> Catchable fatal error: Object of class Bid could not be converted to
> string
>
> On Feb 18, 9:37 am, AdWords API Advisor 
> wrote:
>
>
>
> > Hi,
>
> > You need to retrieve the value the same way you are setting it.  In
> > this case your code should be:
>
> >   $newstatus = $adGroup->bids->keywordMaxCpc;
>
> > Best,
> > - Eric Koleda, AdWords API Team
>
> > On Feb 17, 5:52 pm, "michaelyanda+...@gmail.com" 
> > +...@gmail.com> wrote:
> > > Hi, updating an adgroup CPC is completed smoothly, however I am having
> > > problems printing the value.
>
> > > In PHP, my code is: (Please see $newstatus = $adGroup->keywordMaxCpc;)
>
> > >         // Adjust bid to micro format
> > >         $agcpcG = ($cpc * 100);
>
> > >         // Create ad group bid.
> > >         $adGroupBids = new ManualCPCAdGroupBids();
> > >         $adGroupBids->keywordMaxCpc = new Bid(new Money($agcpcG));
> > >         $adGroup->bids = $adGroupBids;
>
> > >         // Create operations.
> > >         $operation = new AdGroupOperation();
> > >         $operation->operand = $adGroup;
> > >         $operation->operator = 'SET';
>
> > >         $operations = array($operation);
>
> > >         // Update ad group.
> > >         $result = $adGroupService->mutate($operations);
>
> > >         // Display status
> > >                 if (isset($result->value)) {
> > >                         foreach ($result->value as $adGroup) {
> > >                         $newstatus = $adGroup->keywordMaxCpc;
> > >                         }
> > >                 }
> > >                 else {
> > >                 $newstatus = "Error";
> > >                 }
>
> > > Many thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To post to this group, send email to adwords-...@googlegroups.com.
To unsubscribe from this group, send email to 
adwords-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/adwords-api?hl=en.



AdWords API Re: Displaying updated adgroup CPC

2010-02-19 Thread Mike-Indiana
Hi Eric,

Thanks for the reply. I'm running into this error:
Catchable fatal error: Object of class Bid could not be converted to
string



On Feb 18, 9:37 am, AdWords API Advisor 
wrote:
> Hi,
>
> You need to retrieve the value the same way you are setting it.  In
> this case your code should be:
>
>   $newstatus = $adGroup->bids->keywordMaxCpc;
>
> Best,
> - Eric Koleda, AdWords API Team
>
> On Feb 17, 5:52 pm, "michaelyanda+...@gmail.com" 
> +...@gmail.com> wrote:
> > Hi, updating an adgroup CPC is completed smoothly, however I am having
> > problems printing the value.
>
> > In PHP, my code is: (Please see $newstatus = $adGroup->keywordMaxCpc;)
>
> >         // Adjust bid to micro format
> >         $agcpcG = ($cpc * 100);
>
> >         // Create ad group bid.
> >         $adGroupBids = new ManualCPCAdGroupBids();
> >         $adGroupBids->keywordMaxCpc = new Bid(new Money($agcpcG));
> >         $adGroup->bids = $adGroupBids;
>
> >         // Create operations.
> >         $operation = new AdGroupOperation();
> >         $operation->operand = $adGroup;
> >         $operation->operator = 'SET';
>
> >         $operations = array($operation);
>
> >         // Update ad group.
> >         $result = $adGroupService->mutate($operations);
>
> >         // Display status
> >                 if (isset($result->value)) {
> >                         foreach ($result->value as $adGroup) {
> >                         $newstatus = $adGroup->keywordMaxCpc;
> >                         }
> >                 }
> >                 else {
> >                 $newstatus = "Error";
> >                 }
>
> > Many thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To post to this group, send email to adwords-...@googlegroups.com.
To unsubscribe from this group, send email to 
adwords-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/adwords-api?hl=en.



AdWords API Re: Displaying updated adgroup CPC

2010-02-18 Thread AdWords API Advisor
Hi,

You need to retrieve the value the same way you are setting it.  In
this case your code should be:

  $newstatus = $adGroup->bids->keywordMaxCpc;

Best,
- Eric Koleda, AdWords API Team

On Feb 17, 5:52 pm, "michaelyanda+...@gmail.com"  wrote:
> Hi, updating an adgroup CPC is completed smoothly, however I am having
> problems printing the value.
>
> In PHP, my code is: (Please see $newstatus = $adGroup->keywordMaxCpc;)
>
>         // Adjust bid to micro format
>         $agcpcG = ($cpc * 100);
>
>         // Create ad group bid.
>         $adGroupBids = new ManualCPCAdGroupBids();
>         $adGroupBids->keywordMaxCpc = new Bid(new Money($agcpcG));
>         $adGroup->bids = $adGroupBids;
>
>         // Create operations.
>         $operation = new AdGroupOperation();
>         $operation->operand = $adGroup;
>         $operation->operator = 'SET';
>
>         $operations = array($operation);
>
>         // Update ad group.
>         $result = $adGroupService->mutate($operations);
>
>         // Display status
>                 if (isset($result->value)) {
>                         foreach ($result->value as $adGroup) {
>                         $newstatus = $adGroup->keywordMaxCpc;
>                         }
>                 }
>                 else {
>                 $newstatus = "Error";
>                 }
>
> Many thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To post to this group, send email to adwords-...@googlegroups.com.
To unsubscribe from this group, send email to 
adwords-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/adwords-api?hl=en.