Hi Xingguo,
Please use this code example for reference and replace GenerateForecastMetrics info with GenerateHistoricalMetrics info accordingly to fetch the Historical Metrics. Please let me know if you have any further questions.
Thanks and regards,
Xiaoming, Google Ads API Team