Profile Filter Links: list

Wymaga autoryzacji

Wyświetla listę wszystkich linków do filtrów profili w danym profilu. Wypróbuj teraz lub zobacz przykład.

Prośba

Żądanie HTTP

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

Parametry

Nazwa parametru Wartość Opis
Parametry ścieżki
accountId string Identyfikator konta, dla którego mają zostać pobrane linki umożliwiające filtrowanie profili.
profileId string Identyfikator profilu, dla którego mają zostać pobrane linki filtrów. Może to być konkretny identyfikator profilu lub ciąg „~all” oznaczający wszystkie profile, do których użytkownik ma dostęp.
webPropertyId string Identyfikator usługi internetowej dla linków do filtrów profili. Może to być określony identyfikator usługi internetowej lub ciąg „~all” odnoszący się do wszystkich usług internetowych, do których użytkownik ma dostęp.
Opcjonalne parametry zapytania
max-results integer Maksymalna liczba linków filtra profilu do uwzględnienia w tej odpowiedzi.
start-index integer Indeks pierwszej encji do pobrania. Użyj tego parametru jako mechanizmu podziału na strony razem z parametrem max-results.

Upoważnienie

To żądanie wymaga autoryzacji z użyciem co najmniej jednego z tych zakresów (więcej informacji o uwierzytelnianiu i autoryzacji).

Zakres
https://www.googleapis.com/auth/analytics.edit
https://www.googleapis.com/auth/analytics.readonly

Treść żądania

Nie podawaj treści żądania za pomocą tej metody.

Odpowiedź

Jeśli operacja się uda, metoda zwróci odpowiedź o następującej strukturze:

{
  "kind": "analytics#profileFilterLinks",
  "username": string,
  "totalResults": integer,
  "startIndex": integer,
  "itemsPerPage": integer,
  "previousLink": string,
  "nextLink": string,
  "items": [
    management.profileFilterLinks Resource
  ]
}
nazwa usługi, Wartość Opis Uwagi
kind string Typ kolekcji.
username string Identyfikator e-mail uwierzytelnionego użytkownika.
totalResults integer Łączna liczba wyników zapytania, niezależnie od liczby wyników w odpowiedzi.
startIndex integer Początkowy indeks zasobów, który ma domyślnie wartość 1 lub jest określony przez parametr zapytania start-index.
itemsPerPage integer Maksymalna liczba zasobów, które może zawierać odpowiedź, niezależnie od rzeczywistej liczby zwróconych zasobów. Ma ona zakres od 1 do 1000 i domyślnie przyjmuje wartość 1000, ale może być też określona przez parametr zapytania „max-results”.
items[] list Lista linków umożliwiających filtrowanie profili.

Przykłady

Uwaga: dostępne dla tej metody przykłady kodu nie odzwierciedlają wszystkich obsługiwanych języków programowania. Listę obsługiwanych języków znajdziesz na stronie z bibliotekami klienta.

Java

Używa biblioteki klienta 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

Używa biblioteki klienta Pythona.

# 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')

Wypróbuj

Użyj eksploratora interfejsów API poniżej, aby wywołać tę metodę na aktywnych danych i zobaczyć odpowiedź. Możesz też wypróbować samodzielny eksplorator.