Update an individual budget for a specific campaign

2016-01-08 Thread roberto . malcotti
Dear All,

I am quite new with the AdWords API. I have the need to update the budget 
for a list of campaigns. I have to assign a new individual budget, removing 
the previous shared budget.

Up to now I tried to follow the instructions present 
here, https://developers.google.com/adwords/api/docs/guides/budgets, but 
without results.

In the row 70 of my code, i correctly see the new budget, but on the 
AdWords platform I cannot see the result.

I have to change the budget for more than 2000 campaigns, can someone tell 
me where and why my code does not work?

Many many thanks.

Roberto

PS: In the code i iterate trough all the campaigns, because at the moment I 
am not able to select a campaign by name...


package My_Test;

import java.rmi.RemoteException;

import com.google.api.ads.adwords.axis.factory.AdWordsServices;
import com.google.api.ads.adwords.axis.utils.v201509.SelectorBuilder;
import com.google.api.ads.adwords.axis.v201509.cm.ApiException;
import com.google.api.ads.adwords.axis.v201509.cm.Budget;
import 
com.google.api.ads.adwords.axis.v201509.cm.BudgetBudgetDeliveryMethod;
import com.google.api.ads.adwords.axis.v201509.cm.BudgetBudgetPeriod;
import com.google.api.ads.adwords.axis.v201509.cm.BudgetOperation;
import com.google.api.ads.adwords.axis.v201509.cm.BudgetServiceInterface;
import com.google.api.ads.adwords.axis.v201509.cm.Campaign;
import com.google.api.ads.adwords.axis.v201509.cm.CampaignOperation;
import com.google.api.ads.adwords.axis.v201509.cm.CampaignPage;
import com.google.api.ads.adwords.axis.v201509.cm.CampaignReturnValue;
import com.google.api.ads.adwords.axis.v201509.cm.CampaignServiceInterface;
import com.google.api.ads.adwords.axis.v201509.cm.Money;
import com.google.api.ads.adwords.axis.v201509.cm.Operator;
import com.google.api.ads.adwords.axis.v201509.cm.Selector;
import com.google.api.ads.adwords.lib.client.AdWordsSession;
import 
com.google.api.ads.adwords.lib.selectorfields.v201509.cm.CampaignField;
import com.google.api.ads.common.lib.auth.OfflineCredentials;
import com.google.api.ads.common.lib.auth.OfflineCredentials.Api;
import com.google.api.ads.common.lib.conf.ConfigurationLoadException;
import com.google.api.ads.common.lib.exception.OAuthException;
import com.google.api.ads.common.lib.exception.ValidationException;
import com.google.api.client.auth.oauth2.Credential;

public class Budget_Assignetor{
public static void main(String[] args) throws OAuthException, 
ValidationException, ConfigurationLoadException, ApiException, 
RemoteException { 
Credential oAuth2Credential = new 
OfflineCredentials.Builder().forApi(Api.ADWORDS).fromFile().build().generateCredential();//
 
Generate a refreshable OAuth2 credential.
   AdWordsServices adWordsServices = new AdWordsServices();
AdWordsSession session = new 
AdWordsSession.Builder().fromFile().withOAuth2Credential(oAuth2Credential).build();//
 
Construct an AdWordsSession.
BudgetServiceInterface budgetService =  adWordsServices.get(session, 
BudgetServiceInterface.class);
Budget individualBudget = new Budget();
individualBudget.setName("New Budget 1000 euro per day");
Money budgetAmount = new Money();
budgetAmount.setMicroAmount(10L);
individualBudget.setAmount(budgetAmount);
individualBudget.setIsExplicitlyShared(false);
individualBudget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);
individualBudget.setPeriod(BudgetBudgetPeriod.DAILY);
BudgetOperation budgetOperation = new BudgetOperation();
budgetOperation.setOperand(individualBudget);
budgetOperation.setOperator(Operator.ADD); 
Long budgetId =  budgetService.mutate(new BudgetOperation[] 
{budgetOperation}).getValue(0).getBudgetId();
individualBudget.setBudgetId(budgetId);
int PAGE_SIZE = 100;
   CampaignServiceInterface campaignService = adWordsServices.get(session, 
CampaignServiceInterface.class);
   int offset = 0;
   // Create selector.
   SelectorBuilder builder = new SelectorBuilder();
   Selector selector = builder.fields(CampaignField.Id, 
CampaignField.Name).orderAscBy(CampaignField.Name).offset(offset).limit(PAGE_SIZE).build();
   CampaignPage page = null;
   
   do {
 page = campaignService.get(selector);
 if (page.getEntries() != null) {
   for (Campaign campaign : page.getEntries()) {
   if(campaign.getName().equals("Naturdiet | Headterm | BMM")) {
campaign.setBudget(individualBudget);
System.out.println(campaign.getName() + "   " + 
campaign.getBudget().getName());
   CampaignOperation operation = new CampaignOperation();
   operation.setOperand(campaign);
   operation.setOperator(Operator.SET);
   CampaignOperation[] operations = new CampaignOperation[] 
{operation};
   CampaignReturnValue result = 
campaignService.mutate(operations);
   }
   }
 }
 offset += PAG

Re: How to get "Exact" match keyword result while using TargetingIdeaService (v201402)?

2016-01-12 Thread roberto . malcotti
De*ar Vishal,*

have you find a solution for this probelm?

If yes,

can you help me?

Robertp

On Saturday, 28 June 2014 09:04:08 UTC+2, Vishal Chawla wrote:
>
> I am trying to get Average Monthly Search for a keyword using the Adwords 
> API (v201402) in PHP. For this I am using the TagretingIdeaService 
> 
>  by 
> specifying my keyword in the *queries* parameter of 
> RelatedToQuerySearchParameter 
> 
> .
>
> Strangely, the response contains data only for the related keywords but 
> not the exact keyword. I do not find any parameter to specify the 
> *MatchType* as *Exact*. The Adwords Web Interface shows the exact keyword 
> data and related keyword data in two different tables.
>
> Is there any way to get the exact keyword data via API?
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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-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 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/07a244fa-6be8-4fb2-a3ef-845494a561e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get "Exact" match keyword result while using TargetingIdeaService (v201402)?

2016-01-12 Thread roberto . malcotti
Dear Ray,

here the screenshot, i am using the java api and the example 
getKeywordIdeas.

As you can see the script returns just related keywords, but not the 
specific keyword.

Do you know how can I modify the code in order to get the precise 
information?

Thank you so much.

RobertoMalcotti






On Monday, 30 June 2014 22:47:18 UTC+2, Ray Tsang (AdWords API Team) wrote:
>
> Vishal,
>
> Could I trouble you to show me a screenshot of what you are referring to?
>
> Thanks,
>
> Ray
>
> On Saturday, June 28, 2014 3:04:08 AM UTC-4, Vishal Chawla wrote:
>>
>> I am trying to get Average Monthly Search for a keyword using the Adwords 
>> API (v201402) in PHP. For this I am using the TagretingIdeaService 
>> 
>>  by 
>> specifying my keyword in the *queries* parameter of 
>> RelatedToQuerySearchParameter 
>> 
>> .
>>
>> Strangely, the response contains data only for the related keywords but 
>> not the exact keyword. I do not find any parameter to specify the 
>> *MatchType* as *Exact*. The Adwords Web Interface shows the exact 
>> keyword data and related keyword data in two different tables.
>>
>> Is there any way to get the exact keyword data via API?
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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-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 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/983d8e4c-5607-42f3-8e7b-1877f986072f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get "Exact" match keyword result while using TargetingIdeaService (v201402)?

2016-01-12 Thread roberto . malcotti
Dear Vishal,

I got it.

I am using Java but I think for PHP is similar.

When you set the selector,

selector.setRequestType(RequestType.STATS);

if you put .STATS you get the info for the specific keyword.

if you put .IDEAS you get the related keywords.

Hope this can help!

Roberto


On Saturday, 28 June 2014 09:04:08 UTC+2, Vishal Chawla wrote:
>
> I am trying to get Average Monthly Search for a keyword using the Adwords 
> API (v201402) in PHP. For this I am using the TagretingIdeaService 
> 
>  by 
> specifying my keyword in the *queries* parameter of 
> RelatedToQuerySearchParameter 
> 
> .
>
> Strangely, the response contains data only for the related keywords but 
> not the exact keyword. I do not find any parameter to specify the 
> *MatchType* as *Exact*. The Adwords Web Interface shows the exact keyword 
> data and related keyword data in two different tables.
>
> Is there any way to get the exact keyword data via API?
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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-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 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/1a3e7261-666c-42d6-a652-defa030de063%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.