I manage to move 1 step further. Please see details below:

$KeywordPlanIdeaServiceClient = $googleAdsClient->
getKeywordPlanIdeaServiceClient();
$reqArr = array("customerId" => $customerId, "currencyCode" => "EUR");
$generateKeywordForecastMetricsResponse = $KeywordPlanIdeaServiceClient->
generateKeywordForecastMetrics(
$campaigntoforecast, $reqArr);

When I run the above, it shows following error:

Request with ID McC5p-yikN36-NZTR_snFg has failed. Google Ads failure 
details:date_error: The string date's format
should be yyyy-mm-dd.

If I pass the date range, then it start showing Internal Server Error, 
please see below how I am passing the date range:

$KeywordPlanIdeaServiceClient = $googleAdsClient->
getKeywordPlanIdeaServiceClient();
$reqArr = array(
"customerId" => $customerId, 
"currencyCode" => "EUR", 
"forecastPeriod" => array(
"start_date" => "2023-07-1", 
"end_date" => "2024-06-30"
)
);
$generateKeywordForecastMetricsResponse = $KeywordPlanIdeaServiceClient->
generateKeywordForecastMetrics(
$campaigntoforecast, $reqArr);

Could you please have a look on above code and help send the forecastPeriod 
(date range) in correct format. Thanks


On Tuesday, 20 June 2023 at 21:26:49 UTC+5 Aqeel Ashraf wrote:

> Hi,
>
> When tried to call the generate keyword forecast metrices, then it shows 
> "Internal Server Error", please see my code snipped below:
>
> $generateKeywordForecastMetricsResponse = $KeywordPlanIdeaServiceClient->
> generateKeywordForecastMetrics(
>             ResourceNames::forKeywordPlanCampaign($customerId, 
> $keywordCampaignId)
>         );
>
> The above code generates error, could you please let me know what's wrong 
> in above code? Thanks
> On Thursday, 15 June 2023 at 13:03:19 UTC+5 Google Ads API Forum Advisor 
> wrote:
>
>> Hi Aqeel,
>>
>> Thank you for getting back to us. 
>>
>> Moving forward to your concern, I am afraid that the sample code for 
>> KeywordPlanCampaignForecstMetrics is not available in all client libraries 
>> yet. However, you may try it using the API explorer. You may follow this 
>> *document* to generate metrics. You may also check this link 
>> https://developers.google.com/google-ads/api/rest/reference/rest/v14/customers/generateKeywordForecastMetrics
>>  
>> as a reference for Rest API.
>>
>> *Reference link*: 
>>    
>>    - *document* - 
>>    
>> https://developers.google.com/google-ads/api/docs/keyword-planning/generate-forecast-metrics#generate-metrics
>>  
>>
>>
>> Let us know if this helps.
>>
>>   
>> This message is in relation to case "ref:_00D1U1174p._5004Q2m9VpD: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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/2812fdca-3726-4f46-a201-d89e21b56306n%40googlegroups.com.

Reply via email to