ต้องมีการให้สิทธิ์
อัปเดตบัญชี GTM ลองใช้เลยหรือดูตัวอย่าง
ส่งคำขอ
คำขอ HTTP
PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId
พารามิเตอร์
ชื่อพารามิเตอร์ | ค่า | คำอธิบาย |
---|---|---|
พารามิเตอร์เส้นทาง | ||
accountId |
string |
รหัสบัญชี GTM |
พารามิเตอร์การค้นหาที่ไม่บังคับ | ||
fingerprint |
string |
เมื่อระบุ ลายนิ้วมือนี้ต้องตรงกับลายนิ้วมือของบัญชีในพื้นที่เก็บข้อมูล |
การให้สิทธิ์
คำขอนี้ต้องได้รับสิทธิ์ด้วยขอบเขตต่อไปนี้ (อ่านเพิ่มเติมเกี่ยวกับการตรวจสอบสิทธิ์และการให้สิทธิ์)
ขอบเขต |
---|
https://www.googleapis.com/auth/tagmanager.manage.accounts |
เนื้อหาของคำขอ
ในส่วนเนื้อหาของคำขอ ให้ระบุทรัพยากรบัญชีพร้อมด้วยพร็อพเพอร์ตี้ต่อไปนี้
ชื่อพร็อพเพอร์ตี้ | ค่า | คำอธิบาย | Notes |
---|---|---|---|
พร็อพเพอร์ตี้ที่ไม่บังคับ | |||
name |
string |
ชื่อที่แสดงของบัญชี | เขียนได้ |
shareData |
boolean |
บัญชีแชร์ข้อมูลแบบไม่ระบุตัวตนกับ Google และผู้อื่นหรือไม่ | เขียนได้ |
คำตอบ
หากสำเร็จ วิธีการนี้จะแสดงผลทรัพยากรบัญชีในเนื้อหาการตอบสนอง
ตัวอย่าง
หมายเหตุ: ตัวอย่างโค้ดที่มีสำหรับวิธีการนี้ไม่ได้แสดงถึงภาษาโปรแกรมที่รองรับทั้งหมด (ดูรายการภาษาที่รองรับได้ในหน้าไลบรารีของไคลเอ็นต์)
Java
/* * Note: This code assumes you have an authorized tagmanager service object. */ /* * This request updates an existing account for the authorized user. */ // Construct the account object Account account = new Account(); account.setName("Primary GTM Account"); account.setShareData(false); try { Account response = tagmanager.accounts().update("123456", account).execute(); } catch (GoogleJsonResponseException e) { System.err.println("There was a service error: " + e.getDetails().getCode() + " : " + e.getDetails().getMessage()); } /* * The results of the update method are stored in the response object. * The following code shows how to access the updated name and fingerprint. */ System.out.println("Updated Name = " + response.getName()); System.out.println("Updated Fingerprint = " + response.getFingerprint());
Python
# Note: This code assumes you have an authorized tagmanager service object. # This request updates an existing account for the authorized user. try: response = tagmanager.accounts().update( accountId='123456', body={ 'name': 'Primary GTM Account', 'shareData': False } ).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)) # The results of the update method are stored in the response object. # The following code shows how to access the updated name and fingerprint. print 'Updated Name = %s' % response.get('name') print 'Updated Fingerprint = %s' % response.get('fingerprint')
ลองใช้เลย
ใช้ API Explorer ด้านล่างเพื่อเรียกใช้เมธอดนี้กับข้อมูลแบบเรียลไทม์และดูการตอบสนอง