【问题标题】:Bing ads Campaign Management必应广告活动管理
【发布时间】:2016-12-05 23:04:10
【问题描述】:

我最近开始使用 Bing Ads api 来管理我的广告和广告系列,但我在验证用户时遇到了问题(不是 oauth 验证)。

我通过以下方式使用 oauth 对我的用户进行了身份验证

private String devToken = "ZZZZZ";
private String clientId = "AAA0BBB-XXXX-AAAAA";
protected static String UserName = "a.v@h.c";
protected static String Password = "********";

// To get the initial access and refresh tokens you must call requestAccessAndRefreshTokens with the authorization redirection URL.
OAuthTokens tokens = oAuthDesktopMobileAuthCodeGrant.requestAccessAndRefreshTokens(url);

System.out.println("Access token: " + tokens.getAccessToken());
System.out.println("Refresh token: " + tokens.getRefreshToken());

authorizationData = new AuthorizationData();
authorizationData.setDeveloperToken(getDevToken());
authorizationData.setAuthentication(oAuthDesktopMobileAuthCodeGrant);

这可以很好地验证我的用户,因为我可以使用 ICustomerManagementService.class 很好地获取帐户相关信息

customerServiceClient = new ServiceClient<>(authorizationData, ICustomerManagementService.class);
ArrayOfAccount accounts = searchAccountsByUserId(user.getId());

以上工作完美。但是当我尝试对ICampaignManagementService.class 做同样的事情时,如下所示

campaignServiceClient = new ServiceClient<>(authorizationData, ICampaignManagementService.class);
GetAdsByAdGroupIdRequest cReq = new GetAdsByAdGroupIdRequest();
cReq.setAdGroupId(1234567890L);
campaignServiceClient.getService().getAdsByAdGroupId(cReq);

我收到错误代码 106,表示用户未获得授权。

The user does not represent a authorized developer.
106

在这方面有什么帮助吗?

【问题讨论】:

    标签: java bing bing-ads-api


    【解决方案1】:

    请尝试设置 CustomerId 和 CustomerAccountId 标头元素(AuthorizationData 的 CustomerId 和 AccountId)。这些标头不适用于 Customer Management 服务,但适用于 Campaign Management 服务。如果这不能解决问题,请随时将 SOAP 请求 + 响应发送至support 进行调查。我希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多