I’ve been trying to create a custom audience and insert a user list into 
it, adding user data the audience to implement Remarketing features.
I’ve followed a REST interface document (here 
<https://developers.google.com/adwords/api/docs/samples/java/remarketing>) 
for Java Adwords API (com.google.api-ads (ads-lib 4.4.0) (adwords-axis 
4.4.0)), and I can create the audience and check it in the Adwords site (um 
print pode ser util pra ilustrar essa parte) with no problems,  but looks 
like the part of adding the user list into it isnt working.
I’ve followed the documentation guide and can’t see why isnt working, 
someone can please help me with this?
Bellow, the code os the method who create the custom audience and makes the 
import into adwords: 
code<>
 UserListOperation operation = new UserListOperation();
        operation.setOperand(userList);
        operation.setOperator(Operator.ADD);
        UserListReturnValue result = userListService.mutate(new 
UserListOperation[]{operation});
        UserList userListAdded = result.getValue(0);
        System.out.printf(
                "User list with name '%s' and ID %d was added.%n",
                userListAdded.getName(), userListAdded.getId());
        Long userListId = userListAdded.getId();

        MutateMembersOperation mutateMembersOperation = new 
MutateMembersOperation();
        MutateMembersOperand operand = new MutateMembersOperand();
        operand.setUserListId(userListId);
        List<Member> members = new ArrayList<>(EMAILS.size());
        for (String email : EMAILS) {
            String normalizedEmail = textUtils.toNormalizedString(email);
            Member member = new Member();
            
member.setHashedEmail(textUtils.toSHA256String(normalizedEmail));
            members.add(member);
        }
        String firstName;
        String lastName;
        String countryCode;
        String zipCode;
        String tempCountryCode;
        String tempZipCode;
        for (JsonValue jsonValue : jsonUsers) {
            JsonObject obj = jsonValue.asObject();
            firstName = obj.get("firstName").toString();
            lastName = obj.get("lastName").toString();
            countryCode = obj.get("country").toString();
            zipCode = obj.get("zip").toString();
            AddressInfo addressInfo = new AddressInfo();
            
addressInfo.setHashedFirstName(textUtils.toSHA256String(textUtils.toNormalizedString(firstName)));
            
addressInfo.setHashedLastName(textUtils.toSHA256String(textUtils.toNormalizedString(lastName)));

            addressInfo.setCountryCode(clearString(countryCode));
            addressInfo.setZipCode(clearString(zipCode));

            Member memberByAddress = new Member();
            memberByAddress.setAddressInfo(addressInfo);
            members.add(memberByAddress);

        }
        operand.setMembersList(members.toArray(new Member[members.size()]));
        mutateMembersOperation.setOperand(operand);
        mutateMembersOperation.setOperator(Operator.ADD);
        MutateMembersReturnValue mutateMembersResult =
                userListService.mutateMembers(new 
MutateMembersOperation[]{mutateMembersOperation});

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/f544666c-d262-486b-98a7-ed506861b245n%40googlegroups.com.

Reply via email to