Data Segment - Customer List via SFTP or REST API

255 views
Skip to first unread message

Ryszard Rogalski

unread,
Jan 27, 2022, 10:23:51 AM1/27/22
to Google Ads API and AdWords API Forum
Is it possible to add Data Segment (Customer List) via SFTP or REST API?
I can see that I am able to add Conversion's file via SFTP, but for data segments there aren't any viable options.

Untitled.png

Google Ads API Forum Advisor

unread,
Jan 28, 2022, 12:36:11 AM1/28/22
to rys...@genus.one, adwor...@googlegroups.com
Hi Ryszard,

Thank you for posting your concern.

With regard to your question about SFTP, it appears that this is more product related. With this, I would suggest to reach out to the product team via this link to know how to add a Data Segment (Customer List) via SFTP.

As for the adding a Data Segment (Customer List) via Google Ads API, I would suggest to refer to this document as it presents details specific to REST and explains what you need to know to call the REST interface directly such as how to authorize API requests. You may see this section to know how to construct the body of the API requests for Data Segment (Customer List).

In addition, you can read this document to know more information about remarketing and audience targeting in Google Ads API.

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2VQ6nT:ref

Ryszard Rogalski

unread,
Jan 28, 2022, 4:56:53 AM1/28/22
to Google Ads API and AdWords API Forum
Hello sir, so it is possible to add customers TO THE LIST via Rest? Is there an example anywhere how can I structure such a call?

Also, is it possible after to add customers TO THE LIST via SFTP after expanding the current solution?

Ryszard Rogalski

unread,
Jan 28, 2022, 5:38:08 AM1/28/22
to Google Ads API and AdWords API Forum
How can I get the refresh token to the REST auth 2.0 endpoint if I am not using any built in libraries?

Marcin Tabedzki

unread,
Jan 28, 2022, 9:08:33 AM1/28/22
to Google Ads API and AdWords API Forum
Hi Guys, we are facing similar issue - we cannot upload exclusion list of CRM users via REST API. Any ideas how we can do that?

Google Ads API Forum Advisor

unread,
Jan 28, 2022, 1:58:39 PM1/28/22
to marcin....@genus.one, rys...@genus.one, adwor...@googlegroups.com
Hello,

Thank you for reaching out to the Google Ads API support team.

With regards to your concern, the uploading of customers to lists is with customers.offlineUserDataJobs, you will create, add operations and then run it and poll(get) for results. The end points are all in the documentation. "/v9/customers/{customerId}/userLists:mutate" is used for creation and modification of the list itself. You may refer to this REST cookbook to make call.

For your concern about adding customers TO THE LIST via SFTP, we are not supporting. I would suggest to you please reach out to the your SFTP support.

To generate the refresh token without using client library, please see the below step:

First, create a new refresh token by putting this in the browser. Make sure to replace the <INSERT_YOUR_CLIENT_ID_FROM_API_CONSOLE> with your client ID from the Cloud console. There is an extra scope here.  That should return an authorization code in your browser. You'll need that for the next step. Now, on the command line of your server, run the following command to get a refresh token:
  • curl --request POST -H "Content-Type:application/x-www-form-urlencoded" --data "client_id=<INSERT_YOUR_CLIENT_ID_FROM_API_CONSOLE>&client_secret=<INSERT_YOUR_CLIENT_SECRET_FROM_API_CONSOLE>&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code&code=<INSERT_YOUR_AUTHORIZATION_CODE>" https://accounts.google.com/o/oauth2/token
This returns a refresh token.  If that works, then generate an access token from that refresh token.
  • curl --data "refresh_token=<INSERT_REFRESH_TOKEN>&client_id=<INSERT_YOUR_CLIENT_ID_FROM_API_CONSOLE>&client_secret=<INSERT_CLIENT_SECRET>&grant_type=refresh_token" -X POST "https://oauth2.googleapis.com/token"
Now, we want to check the data on the access token to make sure everything on the access token is working as expected. Put this in your browser with the access token inserted that you got back. Then you can try request. Let me know if you have any question.

Thanks,
Google Logo
Nirmita Patel
Google Ads API Team
 

 

ref:_00D1U1174p._5004Q2VQ6nT:ref

Ryszard Rogalski

unread,
Jan 31, 2022, 3:55:12 AM1/31/22
to Google Ads API and AdWords API Forum

Hi,

good news that I have managed to authenticate with our Google Ads platform (I had to create Manager account also to obtain Developer Token).

My task is pretty simple, → generate json and send it to the correct endpoint that will create a customer list.

Can you give me explanation what is {customerId} in this endpoint and give a raw HTTP example of utilizing this endpoint?
Currently, when I am trying to upload something on the address

https://googleads.googleapis.com/v9/customers/{123}/userLists:mutate
I am receiving 400 wrong endpoint error.

Thanks in advance,
Ryszard

Google Ads API Forum Advisor

unread,
Jan 31, 2022, 12:06:41 PM1/31/22
to rys...@genus.one, adwor...@googlegroups.com
Hi Ryszard,


Thank you for reaching out to the Google Ads API support team.

To investigate the issue further, could you please provide us with the complete logs (request and response with request-id) via the Reply privately to the author option?

Ryszard Rogalski

unread,
Feb 2, 2022, 5:39:18 AM2/2/22
to Google Ads API and AdWords API Forum

Issuse has been resolved
For future reference

Enpdoint: https://googleads.googleapis.com/v9/customers/{this_google_number_near_nick_without_dashes}:uploadUserData
Body:
{
"operations": [
{
"create": {
"userIdentifiers": [
{
"hashedEmail": "81bd759b72705c91487709efdfdb947f76ffcc29d8f89859c942ee32d2f05d44"
},
{
"hashedEmail": "c370da2f393e6d7fd7d94c75610291007cdc650afa1312225f568219b01328eb"
}
]
}
}
],
"customerMatchUserListMetadata": {
"userList" : "customers/{this_google_number_near_nick_without_dashes}/userLists/{list_id}"
}
}

Google Ads API Forum Advisor

unread,
Feb 2, 2022, 8:42:44 PM2/2/22
to rys...@genus.one, adwor...@googlegroups.com
Hi Ryszard,

We're glad to know that you were able to resolve the issue on your end.

To confirm, the customerId indeed needs to be without the dashes. Should you then encounter further issues, and if you haven't yet, you may include the -i flag in your requests since you are using the REST interface, to enable logging.

You may then provide those logs to our team privately using the Reply privately to author option.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2VQ6nT:ref
Reply all
Reply to author
Forward
0 new messages