Bing ADs API - GetGeoLocationsFileUrlRequest

时间:2017-11-07 03:52:07

标签: c# bing bing-api bing-ads-api

使用soap ui触发时,下面的soap请求会返回有效的响应。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v11="https://bingads.microsoft.com/CampaignManagement/v11">
   <soapenv:Header>
      <v11:DeveloperToken>DeveloperToken</v11:DeveloperToken>
      <v11:CustomerId>CustomerId</v11:CustomerId>
      <v11:CustomerAccountId>AccountId</v11:CustomerAccountId>
      <v11:AuthenticationToken>Auth Token</v11:AuthenticationToken>
   </soapenv:Header>
   <soapenv:Body>
      <v11:GetGeoLocationsFileUrlRequest>
         <!--Optional:-->
         <v11:Version>2.0</v11:Version>
         <!--Optional:-->
         <v11:LanguageLocale>en</v11:LanguageLocale>
      </v11:GetGeoLocationsFileUrlRequest>
   </soapenv:Body>
</soapenv:Envelope>

但是,当我尝试通过填充Bing Ads API中的详细信息来触发相同的请求时,我看到&#34;身份验证令牌已过期。请更新或获取新令牌。&#34;以下是我正在使用的代码 -

    var getGeoLocationsFileUrlRequest = new GetGeoLocationsFileUrlRequest(null, "Auth Token", "Account ID", "Customer ID", "Developer Token", null, null, "2.0", "en");

    CampaignManagementServiceClient client = new CampaignManagementServiceClient();

    var getGeoLocationsFileUrlResponse = client.GetGeoLocationsFileUrl(getGeoLocationsFileUrlRequest);

1 个答案:

答案 0 :(得分:1)

访问令牌最长可持续一个小时,因此您需要通过Authorization Code Grant Flow获取新访问权限并刷新令牌。如果有帮助here是通过ServiceClient的GetGeoLocationsFileUrl C#示例。