Trying to update the budget programmatically using v13 Gads API

2024-02-01 Thread Mrinal Pant
Can anyone out there can give me a good reference cuz, i cant find proper 
resources for the same.

1. I tried to retrieve the campaign id first to test things out.
from google.ads.googleads.client import GoogleAdsClient

from dotenv import dotenv_values


def get_campaign_id(campaign_name):
config = dotenv_values(".env")

credentials = {
"developer_token": config["developer_token"],
"refresh_token": config["refresh_token"],
"client_id": config["client_id"],
"client_secret": config["client_secret"],
"use_proto_plus": True
}

googleads_client = GoogleAdsClient.load_from_dict(credentials)

customer_id = config.get("account_id")
print(customer_id)

if not customer_id:
print("Google Ads customer ID not provided.")
return None
ga_service = googleads_client.get_service("GoogleAdsService")

query = f"""
SELECT
campaign.id
FROM
campaign
WHERE
campaign.name = '{campaign_name}'
"""

response = ga_service.search(customer_id=customer_id, query=query)

for row in response:
campaign_id = row.campaign.id
print(f"Campaign ID for '{campaign_name}': {campaign_id}")
return campaign_id

# Example usage
campaign_name_to_find = 'wowdare_united-kingdom_eng'
get_campaign_id(campaign_name_to_find)


I got the output in the console, so it worked well.


2. When i tried to update the budget using another function then it shows 
the error where i was trying to get the existing budget using  
CampaignBudgetOperation. 

Is there any other way to update the existing budget for a specific 
campaign.

*AttributeError: Unknown field for CampaignBudgetOperation: get*

def campaign_budget_update(campaign_id, budget):
config = dotenv_values(".env")

credentials = {
"developer_token": config["developer_token"],
"refresh_token": config["refresh_token"],
"client_id": config["client_id"],
"client_secret": config["client_secret"],
"use_proto_plus": True
}

googleads_client = GoogleAdsClient.load_from_dict(credentials)

customer_id = config.get("account_id")

if not customer_id:
print("Google Ads customer ID not provided.")
return None

campaign_budget_service = googleads_client.get_type(
"CampaignBudgetOperation")

# Construct the campaign budget resource name
campaign_budget_resource_name = campaign_id
#print(campaign_budget_resource_name)

# Get the existing campaign budget to modify
existing_campaign_budget = 
campaign_budget_service.get(campaign_budget_resource_name)

# Update the budget amount
existing_campaign_budget.amount_micros = budget * 1_000_000 # Convert 
budget to micros

# Create a mutate operation to update the campaign budget
operation = googleads_client.types.CampaignBudgetOperation(update
=existing_campaign_budget)

# Execute the mutate operation
response = googleads_client.service.campaign_budget.mutate_campaign_budgets(
customer_id=customer_id,
operations=[operation])

# Print the response
print(f"Budget updated for Campaign ID {campaign_id}. Response: {response}")

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/0a69d7c6-51b1-4c9a-aa5f-2e9023d97bc1n%40googlegroups.com.


Re: want to know the status of the basic api access to google ads mcc account

2023-05-10 Thread Mrinal Pant
Where i can find that link to the support ticket??

On Wed, 10 May 2023 at 2:27 PM, Google Ads API Forum Advisor
 wrote:

> Hi Mrinal,
>
> Thank you for your response. As mentioned, we already reached out to the
> Google Ads API Compliance team on your behalf and as per checking, it
> appears that the Compliance team opened a ticket with you with number
> 8-204533784. With that said, kindly continue your discussion with them
> on the mentioned ticket as they are the ones primarily providing support
> regarding this.
>
> Regards,
> [image: Google Logo] Google Ads API Team
>
> ref:_00D1U1174p._5004Q2lAabQ:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/CAFjYRHrpAueToG4hp89NEnZ9UKLEXP7PmD5a4KO4x1yenR5ARQ%40mail.gmail.com.


Re: want to know the status of the basic api access to google ads mcc account

2023-05-10 Thread Mrinal Pant
First 2 Case ids was closed as they mentioned some discrepancy in my form, 
but after that i submitted another api_access_application_form with more 
appropriate information and the case id it generated is  
*7-682333895.*I didn't receive any communication for the above case id.

On Monday, May 8, 2023 at 1:50:46 PM UTC+5:30 Google Ads API Forum Advisor 
wrote:

> Hi Mrinal,
>
> Thank you for providing the requested case2 ID. Kindly note that we 
> already reached out to the Google Ads API Compliance team on your behalf 
> and as per checking, it appears that the Compliance team already reached 
> out to you regarding your application. That being said, I recommend 
> continuing your discussion with them as they are best equipped to provide 
> assistance to this matter.
>
>
> Regards, 
> [image: Google Logo] Google Ads API Team 
>
> ref:_00D1U1174p._5004Q2lAabQ:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/cccff049-b95a-4315-84f5-edd9a605e237n%40googlegroups.com.


Re: want to know the status of the basic api access to google ads mcc account

2023-05-05 Thread Mrinal Pant
Thanks API Team for the response,

I have successfully re-submitted the form again with the changes as 
mentioned in the email.
New *Case ID 7-682333895 *is generated.

Please look into the matter.
Regards,

On Friday, May 5, 2023 at 4:49:53 PM UTC+5:30 Google Ads API Forum Advisor 
wrote:

> Hi Mrinal, 
>
> Greetings from the Google Ads API Support team.
>
> I understand that you have submitted your application and have yet to 
> receive any updates regarding the matter from the compliance team. Kindly 
> note that, our team specializes in *Google Ads API* related concerns and 
> technical implementations *only*. To ensure you get proper assistance, we 
> are reaching out to the *Google Ads API Compliance* team on your behalf 
> and requesting input. 
>
> Can you please provide them with your *manager account id* and the *cases2 
> ID* generated when you have reached out to the Compliance team which has 
> a format of #-# so they can assist you further?
>
> Team, please find the pertinent details below and confirm if you are able 
> to assist.
>
> Mrinal has submitted a request for Google Ads API Standard Access and 
> would like to know the status of their request as they haven't heard back 
> yet. The form says that applications are typically reviewed within three 
> business days. 
>
> Google Ads manager account (MCC) ID:
>
>- 141-339-8878 
>
> Regards,
> [image: Google Logo] Google Ads API Team 
>
> ref:_00D1U1174p._5004Q2lAabQ:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/3c094281-8544-4525-b880-76fb68488726n%40googlegroups.com.


Re: Want to know the status of the Basic API access to Google Ads MCC account

2023-05-04 Thread Mrinal Pant
Here is the screen shot of my recent cases. One is the original application 
and another one is sent when 3 full business days are over as mentioned in 
the new token application form.

On Friday, May 5, 2023 at 10:24:28 AM UTC+5:30 Mrinal Pant wrote:

> This is my Customer id  *141-339-8878* 
> Email id 
>
> *pantmr...@gmail.comPlease let me know if there is any more information 
> needed!*
>
>
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/6239d6c9-474e-4e93-8e36-2352b4e189bfn%40googlegroups.com.


Want to know the status of the Basic API access to Google Ads MCC account

2023-05-04 Thread Mrinal Pant
This is my Customer id  *141-339-8878* 
Email id 

*pantmrinal66@gmail.comPlease let me know if there is any more information 
needed!*



-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/894c7341-6705-4dcf-b32c-6250fdf097bfn%40googlegroups.com.