ต้องมีการให้สิทธิ์
แสดงลิงก์ตัวกรองโปรไฟล์ทั้งหมดสำหรับโปรไฟล์หนึ่งๆ ลองใช้เลยหรือดูตัวอย่าง
ส่งคำขอ
คำขอ 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 |
การให้สิทธิ์
คำขอนี้ต้องได้รับการให้สิทธิ์อย่างน้อย 1 ขอบเขตต่อไปนี้ (อ่านเพิ่มเติมเกี่ยวกับการตรวจสอบสิทธิ์และการให้สิทธิ์)
ขอบเขต |
---|
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 ] }
ชื่อพร็อพเพอร์ตี้ | ค่า | คำอธิบาย | Notes |
---|---|---|---|
kind |
string |
ประเภทคอลเล็กชัน | |
username |
string |
รหัสอีเมลของผู้ใช้ที่ตรวจสอบสิทธิ์แล้ว | |
totalResults |
integer |
จำนวนผลลัพธ์ทั้งหมดสำหรับข้อความค้นหา โดยไม่คำนึงถึงจำนวนผลลัพธ์ในการตอบกลับ | |
startIndex |
integer |
ดัชนีเริ่มต้นของทรัพยากร ซึ่งเท่ากับ 1 โดยค่าเริ่มต้น หรือระบุโดยพารามิเตอร์การค้นหา Start-index | |
itemsPerPage |
integer |
จำนวนทรัพยากรสูงสุดที่การตอบกลับมีได้ โดยไม่คำนึงถึงจำนวนทรัพยากรที่แสดงผลจริง ค่าอยู่ในช่วง 1 ถึง 1,000 โดยมีค่า 1, 000 โดยค่าเริ่มต้น หรือระบุโดยพารามิเตอร์การค้นหาผลลัพธ์สูงสุด | |
previousLink |
string |
ลิงก์ไปยังหน้าก่อนหน้าสำหรับคอลเล็กชันลิงก์ตัวกรองโปรไฟล์นี้ | |
nextLink |
string |
ลิงก์ไปยังหน้าถัดไปสำหรับคอลเล็กชันลิงก์ตัวกรองโปรไฟล์นี้ | |
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 Explorer ด้านล่างเพื่อเรียกใช้เมธอดนี้ในข้อมูลสดและดูการตอบสนอง หรือลองใช้เครื่องมือสำรวจแบบสแตนด์อโลน