Profile Filter Links: list

Memerlukan otorisasi

Mencantumkan semua link filter profil untuk profil. Coba sekarang atau lihat contohnya.

Permintaan

Permintaan HTTP

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

Parameter

Nama parameter Nilai Deskripsi
Parameter jalur
accountId string ID akun untuk mengambil link filter profil.
profileId string ID profil untuk mengambil link filter. Dapat berupa ID profil spesifik atau '~all', yang mengacu pada semua profil yang dapat diakses pengguna.
webPropertyId string ID properti web untuk link filter profil. Dapat berupa ID properti web tertentu atau '~all', yang mengacu pada semua properti web yang dapat diakses pengguna.
Parameter kueri opsional
max-results integer Jumlah maksimum link filter profil yang akan disertakan dalam respons ini.
start-index integer Indeks entity pertama yang akan diambil. Gunakan parameter ini sebagai mekanisme penomoran halaman beserta parameter hasil maksimal.

Otorisasi

Permintaan ini memerlukan otorisasi dengan setidaknya salah satu cakupan berikut (baca selengkapnya tentang autentikasi dan otorisasi).

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

Isi permintaan

Jangan memberikan isi permintaan dengan metode ini.

Respons

Jika berhasil, metode ini akan menampilkan isi respons dengan struktur berikut:

{
  "kind": "analytics#profileFilterLinks",
  "username": string,
  "totalResults": integer,
  "startIndex": integer,
  "itemsPerPage": integer,
  "previousLink": string,
  "nextLink": string,
  "items": [
    management.profileFilterLinks Resource
  ]
}
Nama properti Nilai Deskripsi Catatan
kind string Jenis koleksi.
username string ID email pengguna terautentikasi
totalResults integer Jumlah total hasil untuk kueri, berapa pun jumlah hasil dalam respons.
startIndex integer Indeks awal resource, yang merupakan 1 secara default atau ditentukan oleh parameter kueri indeks awal.
itemsPerPage integer Jumlah maksimum resource yang dapat ditampung respons, berapa pun jumlah resource sebenarnya yang ditampilkan. Nilainya berkisar dari 1 hingga 1.000 dengan nilai 1.000 secara default, atau ditentukan oleh parameter kueri hasil maks.
items[] list Daftar link filter profil.

Contoh

Catatan: Contoh kode yang tersedia untuk metode ini tidak merepresentasikan semua bahasa pemrograman yang didukung (lihat halaman library klien untuk mengetahui daftar bahasa yang didukung).

Java

Menggunakan library klien 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

Menggunakan library klien 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')

Cobalah!

Gunakan APIs Explorer di bawah untuk memanggil metode ini pada data live dan melihat respons. Atau, coba Explorer mandiri.