Are you aware that you can pass the string ~all
for the accountId
and webPropertyID
parameters when listing profiles using the Management API? So all you need to get a list of all profiles is:
HTTP
GET https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles
Java
Profiles profiles = analytics.management.profiles.list("~all", "~all").execute();
Reading the ids from the returned profiles is also trivial.
How can you expect there to be an easier way?