Profile Filter Links: list

Требуется авторизация

Перечисляет все ссылки на фильтры профиля для профиля. Попробуйте сейчас или посмотрите пример .

Запрос

HTTP-запрос

GET https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/profiles/profileId/profileFilterLinks

Параметры

Имя параметра Ценить Описание
Параметры пути
accountId string Идентификатор учетной записи, для которой нужно получить ссылки на фильтр профиля.
profileId string Идентификатор профиля, для которого нужно получить ссылки на фильтры. Это может быть либо конкретный идентификатор профиля, либо «~all», который относится ко всем профилям, к которым у пользователя есть доступ.
webPropertyId string Идентификатор веб-ресурса для ссылок фильтра профиля. Это может быть либо конкретный идентификатор веб-ресурса, либо «~all», который относится ко всем веб-ресурсам, к которым у пользователя есть доступ.
Необязательные параметры запроса
max-results integer Максимальное количество ссылок на фильтры профилей, которые можно включить в этот ответ.
start-index integer Индекс первого извлекаемого объекта. Используйте этот параметр в качестве механизма нумерации страниц вместе с параметром max-results.

Авторизация

Этот запрос требует авторизации хотя бы в одной из следующих областей ( подробнее об аутентификации и авторизации читайте здесь ).

Объем
https://www.googleapis.com/auth/analytics.edit
https://www.googleapis.com/auth/analytics.readonly

Тело запроса

Не предоставляйте тело запроса с помощью этого метода.

Ответ

В случае успеха этот метод возвращает тело ответа следующей структуры:

{
  "kind": "analytics#profileFilterLinks",
  "username": string,
  "totalResults": integer,
  "startIndex": integer,
  "itemsPerPage": integer,
  "previousLink": string,
  "nextLink": string,
  "items": [
    management.profileFilterLinks Resource
  ]
}
Имя свойства Ценить Описание Примечания
kind string Тип коллекции.
username string Идентификатор электронной почты аутентифицированного пользователя
totalResults integer Общее количество результатов по запросу независимо от количества результатов в ответе.
startIndex integer Начальный индекс ресурсов, который по умолчанию равен 1 или иным образом указан параметром запроса start-index.
itemsPerPage integer Максимальное количество ресурсов, которое может содержать ответ, независимо от фактического количества возвращаемых ресурсов. Его значение находится в диапазоне от 1 до 1000 со значением 1000 по умолчанию или иным образом, заданным параметром запроса max-results.
items[] list Список ссылок на фильтры профиля.

Примеры

Примечание. Примеры кода, доступные для этого метода, не представляют все поддерживаемые языки программирования (список поддерживаемых языков см. на странице клиентских библиотек ).

Джава

Использует клиентскую библиотеку Java .

/*
 * Note: This code assumes you have an authorized Analytics service object.
 * See the Filters Developer Guide for details.
 */

/*
 * Example #1:
 * Requests a list of all profile filter links for the authorized user.
 */
try {
  ProfileFilterLinks filterLinks = analytics.management().
      profileFilterLinks().list("123456", "UA-123456-1",
          "7654321").execute();

} catch (GoogleJsonResponseException e) {
  System.err.println("There was a service error: "
      + e.getDetails().getCode() + " : "
      + e.getDetails().getMessage());
}

/*
 * Example 2:
 * The results of the list method are stored in the filterLinks object.
 * The following code shows how to iterate through them.
 */
for (ProfileFilterLink link : filterLinks.getItems()) {
  System.out.println("Link Id = " + link.getId());
  System.out.println("Link Kind = " + link.getKind());

  // Get the profile reference.
  ProfileRef profileRef = link.getProfileRef();
  System.out.println("Profile Id = " + profileRef.getId());
  System.out.println("Profile Kind = " + profileRef.getKind());
  System.out.println("Profile Account Id = " + profileRef.getAccountId());
  System.out.println("Profile Property Id = " + profileRef.getWebPropertyId());
  System.out.println("Profile Name = " + profileRef.getName());

  // Get the filter reference.
  FilterRef filterRef = link.getFilterRef();
  System.out.println("Filter Id = " + filterRef.getId());
  System.out.println("Filter Account Id = " + filterRef.getAccountId());
  System.out.println("Filter Name = " + filterRef.getName());
}

Питон

Использует клиентскую библиотеку Python .

# Note: This code assumes you have an authorized Analytics service object.
# See the Filters Developer Guide for details.

# Example #1:
# Requests a list of all profile filter links for the authorized user.
try:
  filterLinks = analytics.management().profileFilterLinks().list(
      accountId='123456'
      webPropertyId='UA-123456-1',
      profileId='7654321'
  ).execute()

except TypeError, error:
  # Handle errors in constructing a query.
  print 'There was an error in constructing your query : %s' % error

except HttpError, error:
  # Handle API errors.
  print ('There was an API error : %s : %s' %
         (error.resp.status, error.resp.reason))


# Example #2:
# The results of the list method are stored in the filterLinks object.
# The following code shows how to iterate through them.
for link in filterLinks.get('items', []):
  print 'Link Id = %s' % link.get('id')
  print 'Link Kind = %s' % link.get('kind')

  # Get the profile reference.
  profileRef = link.get('profileRef', {})
  print 'Profile Id = %s' % profileRef.get('id')
  print 'Profile Kind = %s' % profileRef.get('kind')
  print 'Profile Account Id = %s' % profileRef.get('accountId')
  print 'Profile Property Id = %s' % profileRef.get('webPropertyId')
  print 'Profile Name = %s' % profile.get('name')

  # Get the filter reference.
  filterRef = link.get('filterRef', {})
  print 'Filter Id = %s' % filterRef.get('id')
  print 'Filter Account Id = %s' % filterRef.get('accountId')
  print 'Filter Name = %s' % filterRef.get('name')

Попробуй это!

Используйте API-обозреватель ниже, чтобы вызвать этот метод для реальных данных и просмотреть ответ. Альтернативно попробуйте автономный Проводник .