Re: How to set the bidCeiling & bidFloor for a Target ROAS Portfolio strategy via api in python?

2019-01-12 Thread Skyler Christensen
Ok I got it to work. I needed to set the xsitype and also send all the 
fields for the respective biddingscheme object:
Here is the working code:
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""This example updates a campaign by setting its status to PAUSED.

To get campaigns, run get_campaigns.py.

The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication 
information"
section of our README.

"""
#test api strategy id
#1855829761

from googleads import adwords


STRATEGY_ID = '1855829761'


def main(client, strategy_id):
# Initialize appropriate service.
campaign_service = client.GetService('BiddingStrategyService', version=
'v201809')

# Construct operations and update campaign.
operations = [{
'operator': 'SET',
'operand': {
'id': strategy_id,
'name': 'TEST ' + strategy_id,
'biddingScheme': {
'xsi_type': 'TargetRoasBiddingScheme',
# Optionally set additional bidding scheme parameters.
'targetRoas': 2.5,

'bidCeiling': {
'microAmount': '300'
},
'bidFloor': {
'microAmount': '00'
}
}
}
}]
campaigns = campaign_service.mutate(operations)

# Display results.
for campaign in campaigns['value']:
print ('Campaign with name "%s" and id "%s" was updated.'
% (campaign['name'], campaign['id']))

if __name__ == '__main__':
# Initialize client object.
adwords_client = adwords.AdWordsClient.LoadFromStorage()

main(adwords_client, STRATEGY_ID)



On Friday, January 11, 2019 at 5:37:11 PM UTC-10, Skyler Christensen wrote:
>
> This is what I've got so far. I just don't know how to set the bidCeiling 
> or how to structure the operations object.
> STRATEGY_ID = '1855829761'
>
>
> def main(client, strategy_id):
> # Initialize appropriate service.
> campaign_service = client.GetService('BiddingStrategyService', version=
> 'v201809')
>
> # Construct operations and update campaign.
> operations = [{
> 'operator': 'SET',
> 'operand': {
> 'id': strategy_id,
> 'name': 'TEST ' + strategy_id,
> 'biddingScheme': {
> 'TargetRoasBiddingScheme': {
> 'bidCeiling': {
> 'microAmount': '100'
> } 
> }
> # Optionally set additional bidding scheme parameters.
> }
> }
> }]
> campaigns = campaign_service.mutate(operations)
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@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
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c5643ab6-a4d5-4575-ae6a-74ee625f670c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to set the bidCeiling & bidFloor for a Target ROAS Portfolio strategy via api in python?

2019-01-11 Thread Skyler Christensen
Oh and the error is that it can't find the key TargetRoasBiddingScheme

On Friday, January 11, 2019 at 5:37:11 PM UTC-10, Skyler Christensen wrote:
>
> This is what I've got so far. I just don't know how to set the bidCeiling 
> or how to structure the operations object.
> STRATEGY_ID = '1855829761'
>
>
> def main(client, strategy_id):
> # Initialize appropriate service.
> campaign_service = client.GetService('BiddingStrategyService', version=
> 'v201809')
>
> # Construct operations and update campaign.
> operations = [{
> 'operator': 'SET',
> 'operand': {
> 'id': strategy_id,
> 'name': 'TEST ' + strategy_id,
> 'biddingScheme': {
> 'TargetRoasBiddingScheme': {
> 'bidCeiling': {
> 'microAmount': '100'
> } 
> }
> # Optionally set additional bidding scheme parameters.
> }
> }
> }]
> campaigns = campaign_service.mutate(operations)
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@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
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/0ac89303-92de-47e2-8cdf-73671d4e03be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to set the bidCeiling & bidFloor for a Target ROAS Portfolio strategy via api in python?

2019-01-11 Thread Skyler Christensen
This is what I've got so far. I just don't know how to set the bidCeiling 
or how to structure the operations object.
STRATEGY_ID = '1855829761'


def main(client, strategy_id):
# Initialize appropriate service.
campaign_service = client.GetService('BiddingStrategyService', version=
'v201809')

# Construct operations and update campaign.
operations = [{
'operator': 'SET',
'operand': {
'id': strategy_id,
'name': 'TEST ' + strategy_id,
'biddingScheme': {
'TargetRoasBiddingScheme': {
'bidCeiling': {
'microAmount': '100'
} 
}
# Optionally set additional bidding scheme parameters.
}
}
}]
campaigns = campaign_service.mutate(operations)

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@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
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/76f38c40-e94a-464c-9140-f7a9a257edb9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.