Profile Filter Links: list

נדרשת הרשאה

בתיבת הדו-שיח הזו מוצגים כל הקישורים של מסנני הפרופיל בפרופיל. אפשר לנסות עכשיו או לראות דוגמה.

בקשה

בקשת HTTP

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

פרמטרים

שם הפרמטר Value התיאור
פרמטרים של נתיב
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
  ]
}
שם הנכס Value התיאור הערות
kind string סוג האוסף.
username string מזהה האימייל של המשתמש המאומת
totalResults integer המספר הכולל של התוצאות לשאילתה, ללא קשר למספר התוצאות שהתקבלו בתגובה.
startIndex integer האינדקס ההתחלתי של המשאבים, שהוא 1 כברירת מחדל או שמצוין באופן אחר באמצעות פרמטר השאילתה start-index.
itemsPerPage integer מספר המשאבים המקסימלי שהתגובה יכולה להכיל, ללא קשר למספר המשאבים שהוחזרו בפועל. הערך נע בין 1 ל-1,000 עם ערך של 1,000 כברירת מחדל, או שצוין אחרת על ידי פרמטר השאילתה max-results.
items[] list רשימת קישורים למסנן פרופיל.

דוגמאות

הערה: דוגמאות הקוד הזמינות לשיטה זו לא מייצגות את כל שפות התכנות הנתמכות (רשימת השפות הנתמכות זמינה בדף של ספריות המשתמשים).

Java

משתמש בספריית הלקוח של 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

עושה שימוש בספריית הלקוח של 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')

רוצה לנסות?

ניתן להשתמש ב-APIs Explorer שבהמשך כדי לקרוא לשיטה הזו בנתונים בזמן אמת ולראות את התגובה. אפשר גם לנסות את הכלי העצמאי Explorer.