Re: getting googleadsexception from apiexception (php)

2024-01-03 Thread Michael Shepard
Yeah but contained within the ApiException is a  GoogleAdsFailure. using 
the php library how do I create an instance of that  GoogleAdsFailure from 
the apiException?

On Tuesday, January 2, 2024 at 5:18:22 PM UTC-5 Google Ads API Forum 
Advisor wrote:

> Hi,
>
> Thank you for reaching out to the Google Ads API support team.
>
> By reviewing your concern, I understand that you are getting an error 
> message "INVALID_ARGUMENT". You can refer to this documentation 
>  for 
> more information on the common errors related to the Google Ads API 
> .
>
> In order to further investigate the error you encountered, provide us 
> complete API logs (request 
> 
>  and response 
> 
>  with request-id 
> 
>  and request header 
> )
>  
> generated at your end and uncropped UI screenshot of the Google Ads account 
> where you are facing the issue.
>
> If you are using a client library and haven't enabled the logging yet, I 
> would request you to enable logging for the specific client library that 
> you are using. You can refer to the guides Java 
> 
> , .Net 
> 
> , PHP 
> 
> , Python 
> 
> , Ruby 
> 
>  or Perl 
>  
> to 
> enable logging at your end. For REST interface requests, you can enable 
> logging via the curl command by using the -i flag.
>
>   
> This message is in relation to case "ref:!00D1U01174p.!5004Q02r4uw7:ref"
>
> Thanks,
>   
> [image: Google Logo] Google Ads API Team 
>
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/43bb3f7b-0cdf-4b3f-83a9-4e16cdb30f37n%40googlegroups.com.


getting GoogleAdsException from ApiException (PHP)

2024-01-02 Thread Michael Shepard
I'm using the php library v15 in a laravel application.I'm trying to catch 
exceptions and request policy exemptions like it is shown in the keywords 
example in the github repo. however, I'm throwing an ApiException NOT a 
GoogleAdsException. I've included an example of what my exception looks 
like. How do I create a GoogleAdsException from the ApiException so I can 
work with that instead of the ApiException? Any advice would be helpful.

Thanks!!

Google\ApiCore\ApiException: {
"message": "Request contains an invalid argument.",
"code": 3,
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": 
"type.googleapis.com\/google.ads.googleads.v15.errors.GoogleAdsFailure",
"errors": [
{
"errorCode": {
"policyViolationError": "POLICY_ERROR"
},
"message": "A policy was violated. See 
PolicyViolationDetails for more detail.",
"trigger": {
"stringValue": "3012944502"
},
"location": {
"fieldPathElements": [
{
"fieldName": "operations",
"index": 2
},
{
"fieldName": "create"
},
{
"fieldName": "keyword"
},
{
"fieldName": "text"
}
]
},
"details": {
"policyViolationDetails": {
"externalPolicyDescription": "Remove any phone 
number in the ad text. If you want customers to call you, consider using 
call extensions or call-only ads.",
"key": {
"policyName": "PHONE_NUMBER_IN_AD_TEXT",
"violatingText": "3012944502"
},
"externalPolicyName": "Phone number in ad text",
"isExemptible": true
}
}
},
{
"errorCode": {
"criterionError": "KEYWORD_TEXT_TOO_LONG"
},
"message": "Keyword text should be less than 80 chars.",
"trigger": {
"stringValue": 
"MKD090B-047-KP1-KNMKD090B-047-KP1-KNMKD090B-047-KP1-KNMKD090B-047-KP1-KNMKD090B-047-KP1-KN"
},
"location": {
"fieldPathElements": [
{
"fieldName": "operations",
"index": 3
},
{
"fieldName": "create"
},
{
"fieldName": "keyword"
},
{
"fieldName": "text"
}
]
}
}
],
"requestId": "uzgE-DmswM1KKYuAIvyP7Q"
}
]
}

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/5ce28c10-9a94-4083-9d39-0380fe930d77n%40googlegroups.com.


Basic Setup, PHP, Service account flow

2023-04-20 Thread Michael Shepard
I am attempting initial setup and testing for my project. I have installed 
the google-ads-php library in my project with composer, I have created a 
service account, and downloaded my JSON key. I have created the 
google_ads_php.ini. I am attempting to create the basic "GetCampaigns" 
utility using the example provided in the repo. when I execute from my 
command line I get
"PHP Fatal error:  Uncaught GuzzleHttp\Exception\ClientException: Client 
error: `POST https://oauth2.googleapis.com/token` resulted in a `401 
Unauthorized` response:
{
  "error": "unauthorized_client",
  "error_description": "Client is unauthorized to retrieve access tokens 
using this  (truncated...)
 in 
/var/www/hydraulics/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113"

Any help would be appreciated

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/58ff2e83-0ac1-40c6-878a-48ba193920c1n%40googlegroups.com.