Cần có uỷ quyền
Liệt kê tất cả các liên kết lọc hồ sơ của một hồ sơ. Thử ngay hoặc xem ví dụ.
Yêu cầu
Yêu cầu HTTP
GET https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/profiles/profileId/profileFilterLinks
Tham số
Tên thông số | Giá trị | Nội dung mô tả |
---|---|---|
Tham số đường dẫn | ||
accountId |
string |
Mã tài khoản để truy xuất các đường liên kết đến bộ lọc hồ sơ. |
profileId |
string |
Mã hồ sơ để truy xuất đường liên kết đến bộ lọc. Có thể là một mã hồ sơ cụ thể hoặc "~all" đề cập đến tất cả các hồ sơ mà người dùng có quyền truy cập. |
webPropertyId |
string |
Id thuộc tính web cho các liên kết bộ lọc của hồ sơ. Có thể là một mã thuộc tính web cụ thể hoặc "~all" đề cập đến tất cả các thuộc tính web mà người dùng có quyền truy cập. |
Tham số truy vấn không bắt buộc | ||
max-results |
integer |
Số lượng tối đa đường liên kết bộ lọc hồ sơ được đưa vào câu trả lời này. |
start-index |
integer |
Chỉ mục của thực thể đầu tiên cần truy xuất. Sử dụng thông số này làm cơ chế phân trang cùng với thông số kết quả tối đa. |
Ủy quyền
Yêu cầu này cần được uỷ quyền với ít nhất một trong các phạm vi sau (đọc thêm về quy trình xác thực và uỷ quyền).
Phạm vi |
---|
https://www.googleapis.com/auth/analytics.edit |
https://www.googleapis.com/auth/analytics.readonly |
Nội dung yêu cầu
Không cung cấp nội dung yêu cầu bằng phương thức này.
Phản hồi
Nếu thành công, phương thức này sẽ trả về nội dung phản hồi có cấu trúc như sau:
{ "kind": "analytics#profileFilterLinks", "username": string, "totalResults": integer, "startIndex": integer, "itemsPerPage": integer, "previousLink": string, "nextLink": string, "items": [ management.profileFilterLinks Resource ] }
Tên tài sản | Giá trị | Nội dung mô tả | Ghi chú |
---|---|---|---|
kind |
string |
Loại bộ sưu tập. | |
username |
string |
Mã email của người dùng đã xác thực | |
totalResults |
integer |
Tổng số kết quả cho truy vấn, bất kể số lượng kết quả trong phản hồi. | |
startIndex |
integer |
Chỉ mục bắt đầu của tài nguyên, là 1 theo mặc định hoặc được chỉ định khác bởi tham số truy vấn chỉ mục bắt đầu. | |
itemsPerPage |
integer |
Số lượng tài nguyên tối đa mà phản hồi có thể chứa, bất kể số lượng tài nguyên thực tế được trả về. Giá trị của nó dao động từ 1 đến 1.000 với giá trị là 1000 theo mặc định hoặc được chỉ định bởi tham số truy vấn kết quả tối đa. | |
previousLink |
string |
Liên kết đến trang trước của tập hợp liên kết bộ lọc hồ sơ này. | |
nextLink |
string |
Liên kết đến trang tiếp theo của tập hợp liên kết bộ lọc hồ sơ này. | |
items[] |
list |
Danh sách đường liên kết để lọc hồ sơ. |
Ví dụ
Lưu ý: Các đoạn mã mẫu của phương thức này không phải là ví dụ cho mọi ngôn ngữ lập trình được hỗ trợ (xem trang thông tin về các thư viện dùng cho ứng dụng để biết danh sách các ngôn ngữ được hỗ trợ).
Java
Sử dụng thư viện ứng dụng 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
Sử dụng thư viện ứng dụng 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')
Hãy dùng thử!
Sử dụng APIs Explorer bên dưới để gọi phương thức này trên dữ liệu trực tiếp và xem phản hồi. Ngoài ra, hãy dùng thử Trình khám phá độc lập.