Google ads Rest API

193 views
Skip to first unread message

MEGANATHAN P

unread,
Apr 22, 2023, 4:31:45 AM4/22/23
to Google Ads API and AdWords API Forum
Hi,
Hello Team ,


How to integrate the google ads audience list creation and add/remove/get the member into the audience list using google ads rest api ?



Regrading,

Meganathan P

Google Ads API and AdWords API Forum

unread,
Apr 24, 2023, 10:51:04 AM4/24/23
to Google Ads API and AdWords API Forum
Re-posting the last inquiry (https://groups.google.com/g/adwords-api/c/4ryCrBUObOk) from the forum as it wasn't routed to our support queue.

Regards,
Google Ads API Team

Google Ads API and AdWords API Forum

unread,
Apr 25, 2023, 8:51:39 AM4/25/23
to Google Ads API and AdWords API Forum
Hi,

Thank you for reaching out to us.

Regarding your concern, please see this Method: customers.audiences.mutate (https://developers.google.com/google-ads/api/rest/reference/rest/v13/customers.audiences/mutate) as this is for creating audiences. For more information about Audiences, you may check our Audience Management guide (https://developers.google.com/google-ads/api/docs/remarketing/overview). Also, can you confirm if you are referring to a customer match? If so, you may check the below guide:

You will need to create a userlist:
Sample code:
curl -X POST "https://googleads.googleapis.com/$(version)/customers/$CustomerID)/userLists:mutate" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
--header "developer-token: ${DEVELOPER_TOKEN}" \
--header "login-customer-id: ${LOGIN_CUSTOMER_ID}" \
--data "{
'operations': [
{
'create': {
'crmBasedUserList': {
'uploadKeyType': 'CONTACT_INFO'
},
'name': 'Customer Match list $(date)',
'description': 'A list of customers that originated from email addresses',
'membershipLifeSpan': 30
}
}
]

# Substitute ${USER_LIST_RESOURCE_NAME} with the user list resource name
# returned when creating the user list in the last step.

And then you will need to create an offlineuserdatajob to upload data:


curl -X POST "https://googleads.googleapis.com/$(version)/customers/$CustomerID)//offlineUserDataJobs:create" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
--header "developer-token: ${DEVELOPER_TOKEN}" \
--header "login-customer-id: ${LOGIN_CUSTOMER_ID}" \
--data "{
'job': {
'type': 'CUSTOMER_MATCH_USER_LIST',
'customerMatchUserListMetadata': {
'userList': '${USER_LIST_RESOURCE_NAME}'
}
}
}"


Lastly, you will need to use the offlineUserDataJobs.addOperations to Add operations to the offline user data job.


# Substitute ${OFFLINE_USER_DATA_JOB_ID} with the offline user data
# job ID (a long number) returned when creating the job in the last step.
# Uploads email, first name, last name, and address data to the job.
# Note: Emails, first names, and last names must be SHA-256 encoded.


curl -X POST "https://googleads.googleapis.com/$(version)/customers/$CustomerID)/offlineUserDataJobs/${OFFLINE_USER_DATA_JOB_ID}:addOperations" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
--header "developer-token: ${DEVELOPER_TOKEN}" \
--header "login-customer-id: ${LOGIN_CUSTOMER_ID}" \
--data "{
'operations': {
'create': {
'userIdentifiers': {
'hashedEmail': 'REDACTED'
}
}
},
'operations': {
'create': {
'userIdentifiers': {
'addressInfo': {
'hashedFirstName': 'REDACTED',
'hashedLastName': 'REDACTED',
'countryCode': 'US',
'postalCode': '10011'
}
}
}
},
'enablePartialFailure': 'true'
}"

To check your offlineuserdatajob's status, you may use the offline_user_data_job report.

Let us know if this is what you are looking for.


Links included in this email:

Regards,
Google Ads API Team
On Saturday, April 22, 2023 at 4:31:45 PM UTC+8 meganath...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages