添加 RemarketingUserList 时出现 UNEXPECTED_INTERNAL_API_ERROR

发布于 2024-12-22 22:00:42 字数 3452 浏览 0 评论 0原文

我使用的是 google-adwords 版本 v201101。尝试插入 RemarketingUserList 时,我收到错误

@errors:triggerxsi_typeInternalApiErrorreasonUNEXPECTED_INTERNAL_API_ERRORerror_stringInternalApiError.UNEXECTED_INTERNAL_API_ERRORfield_path

如何避免此错误?

我的代码截图

private void createUserList() throws Exception {
    // Create conversion type (tag).
    UserListConversionType conversionType = new UserListConversionType();
    conversionType.setName("Mars cruise customers");

    // Create remarketing user list.
    RemarketingUserList userList = new RemarketingUserList();
    userList.setName("Mars cruise customers #" + System.currentTimeMillis());
    userList.setDescription("A list of mars cruise customers in the last year");
    userList.setMembershipLifeSpan(365L);
    userList.setConversionTypes(new UserListConversionType[] { conversionType });

    // Create operations.
    UserListOperation operation = new UserListOperation();
    operation.setOperand(userList);
    operation.setOperator(Operator.ADD);

    UserListOperation[] operations = new UserListOperation[] { operation };

    // Add user list.
    UserListReturnValue result = getUserListService().mutate(operations);

    // Capture the ID(s) of the conversion.
    List<String> conversionIds = new ArrayList<String>();
    UserList userListResult = result.getValue()[0];
    if (userListResult instanceof RemarketingUserList) {
        RemarketingUserList remarketingUserList = (RemarketingUserList) userListResult;
        for (UserListConversionType userListConversionType : remarketingUserList
                .getConversionTypes()) {
            conversionIds.add(userListConversionType.getId().toString());
        }
    }

    log.trace("List of conversionIds: " +conversionIds);

    // Create predicate and selector.
    Predicate predicate = new Predicate();
    predicate.setField("Id");
    predicate.setOperator(PredicateOperator.IN);
    predicate.setValues(conversionIds.toArray(new String[conversionIds.size()]));
    Selector selector = new Selector();
    selector.setFields(new String[] { "Id" });
    selector.setPredicates(new Predicate[] { predicate });

    // Get all conversion trackers.
    Map<Long, AdWordsConversionTracker> conversionTrackers = new HashMap<Long, AdWordsConversionTracker>();
    ConversionTrackerPage page = getConversionTrackerService()
            .get(selector);
    if (page != null && page.getEntries() != null) {
        for (ConversionTracker conversionTracker : page.getEntries()) {
            conversionTrackers.put(conversionTracker.getId(),
                    (AdWordsConversionTracker) conversionTracker);
        }
    }

    log.trace("User list with name " + userListResult.getName()
            + " and id " + userListResult.getId() + " was added.\n");

    // Display user list associated conversion code snippets.
    if (userListResult instanceof RemarketingUserList) {
        RemarketingUserList remarketingUserList = (RemarketingUserList) userListResult;
        for (UserListConversionType userListConversionType : remarketingUserList
                .getConversionTypes()) {
            log.trace("Conversion type code snippet associated to the list:\n"
                            + conversionTrackers.get(
                                    userListConversionType.getId())
                                    .getSnippet() + "\n");
        }
    }
}

I am using google-adwords version v201101. When trying to insert the RemarketingUserList, I am getting the error

@errors: triggerxsi_typeInternalApiErrorreasonUNEXPECTED_INTERNAL_API_ERRORerror_stringInternalApiError.UNEXECTED_INTERNAL_API_ERRORfield_path

How to avoid this error?

My code snipper

private void createUserList() throws Exception {
    // Create conversion type (tag).
    UserListConversionType conversionType = new UserListConversionType();
    conversionType.setName("Mars cruise customers");

    // Create remarketing user list.
    RemarketingUserList userList = new RemarketingUserList();
    userList.setName("Mars cruise customers #" + System.currentTimeMillis());
    userList.setDescription("A list of mars cruise customers in the last year");
    userList.setMembershipLifeSpan(365L);
    userList.setConversionTypes(new UserListConversionType[] { conversionType });

    // Create operations.
    UserListOperation operation = new UserListOperation();
    operation.setOperand(userList);
    operation.setOperator(Operator.ADD);

    UserListOperation[] operations = new UserListOperation[] { operation };

    // Add user list.
    UserListReturnValue result = getUserListService().mutate(operations);

    // Capture the ID(s) of the conversion.
    List<String> conversionIds = new ArrayList<String>();
    UserList userListResult = result.getValue()[0];
    if (userListResult instanceof RemarketingUserList) {
        RemarketingUserList remarketingUserList = (RemarketingUserList) userListResult;
        for (UserListConversionType userListConversionType : remarketingUserList
                .getConversionTypes()) {
            conversionIds.add(userListConversionType.getId().toString());
        }
    }

    log.trace("List of conversionIds: " +conversionIds);

    // Create predicate and selector.
    Predicate predicate = new Predicate();
    predicate.setField("Id");
    predicate.setOperator(PredicateOperator.IN);
    predicate.setValues(conversionIds.toArray(new String[conversionIds.size()]));
    Selector selector = new Selector();
    selector.setFields(new String[] { "Id" });
    selector.setPredicates(new Predicate[] { predicate });

    // Get all conversion trackers.
    Map<Long, AdWordsConversionTracker> conversionTrackers = new HashMap<Long, AdWordsConversionTracker>();
    ConversionTrackerPage page = getConversionTrackerService()
            .get(selector);
    if (page != null && page.getEntries() != null) {
        for (ConversionTracker conversionTracker : page.getEntries()) {
            conversionTrackers.put(conversionTracker.getId(),
                    (AdWordsConversionTracker) conversionTracker);
        }
    }

    log.trace("User list with name " + userListResult.getName()
            + " and id " + userListResult.getId() + " was added.\n");

    // Display user list associated conversion code snippets.
    if (userListResult instanceof RemarketingUserList) {
        RemarketingUserList remarketingUserList = (RemarketingUserList) userListResult;
        for (UserListConversionType userListConversionType : remarketingUserList
                .getConversionTypes()) {
            log.trace("Conversion type code snippet associated to the list:\n"
                            + conversionTrackers.get(
                                    userListConversionType.getId())
                                    .getSnippet() + "\n");
        }
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅沫记忆 2024-12-29 22:00:43

UNEXPECTED_INTERNAL_API_ERROR 表示 Google 服务器端存在一些问题。您能否获取 SOAP 请求/响应并将其发布到 http://groups.google.com/ 上组/adwords-api ?这是 AdWords API 的官方论坛,Google 的人员会与您联系。

根据您的代码,我假设您正在使用 AdWords API 的 Java 客户端库。如果是这样,日志记录设置位于 log4j.properties 文件。

UNEXPECTED_INTERNAL_API_ERROR means that there is some issue on the Google server side. Could you please obtain a SOAP request/response and post it on http://groups.google.com/group/adwords-api ? That's the official forum for AdWords API, and someone from Google will follow up with you.

Based on your code, I assume you are using the Java client library for AdWords API. If so, the logging settings are in the log4j.properties file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文