ต้องมีการให้สิทธิ์
อัปเดตเวอร์ชันคอนเทนเนอร์ ลองใช้เลยหรือดูตัวอย่าง
ส่งคำขอ
คำขอ HTTP
PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId/containers/containerId/versions/containerVersionId
พารามิเตอร์
ชื่อพารามิเตอร์ | ค่า | คำอธิบาย |
---|---|---|
พารามิเตอร์เส้นทาง | ||
accountId |
string |
รหัสบัญชี GTM |
containerId |
string |
รหัสคอนเทนเนอร์ GTM |
containerVersionId |
string |
รหัสเวอร์ชันคอนเทนเนอร์ GTM |
พารามิเตอร์การค้นหาที่ไม่บังคับ | ||
fingerprint |
string |
หากระบุ ลายนิ้วมือนี้ต้องตรงกับลายนิ้วมือของเวอร์ชันคอนเทนเนอร์ในพื้นที่เก็บข้อมูล |
การให้สิทธิ์
คำขอนี้ต้องได้รับสิทธิ์ด้วยขอบเขตต่อไปนี้ (อ่านเพิ่มเติมเกี่ยวกับการตรวจสอบสิทธิ์และการให้สิทธิ์)
ขอบเขต |
---|
https://www.googleapis.com/auth/tagmanager.edit.containerversions |
เนื้อหาของคำขอ
ในเนื้อหาคำขอ ให้ระบุทรัพยากรเวอร์ชันคอนเทนเนอร์พร้อมด้วยพร็อพเพอร์ตี้ต่อไปนี้
ชื่อพร็อพเพอร์ตี้ | ค่า | คำอธิบาย | Notes |
---|---|---|---|
พร็อพเพอร์ตี้ที่ไม่บังคับ | |||
name |
string |
ชื่อที่แสดงของเวอร์ชันคอนเทนเนอร์ | เขียนได้ |
notes |
string |
ผู้ใช้ระบุวิธีใช้คอนเทนเนอร์เวอร์ชันนี้ในคอนเทนเนอร์ | เขียนได้ |
คำตอบ
หากสำเร็จ เมธอดนี้จะแสดงผลทรัพยากรเวอร์ชันคอนเทนเนอร์ในเนื้อหาการตอบสนอง
ตัวอย่าง
หมายเหตุ: ตัวอย่างโค้ดที่มีสำหรับวิธีการนี้ไม่ได้แสดงถึงภาษาโปรแกรมที่รองรับทั้งหมด (ดูรายการภาษาที่รองรับได้ในหน้าไลบรารีของไคลเอ็นต์)
Java
/* * Note: This code assumes you have an authorized tagmanager service object. */ /* * This request updates an existing container version. */ // Create the container version object. ContainerVersion version = new ContainerVersion(); version.setName("Updated Container Version"); version.setNotes("This Container Version was updated."); try { ContainerVersion response = tagmanager.accounts().containers(). versions().update("123456", "54321", "2", version).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 container version try: response = tagmanager.accounts().containers().versions().update( accountId='123456', containerId='54321', containerVersionId='2', body={ 'name': 'Updated Container Version', 'notes': 'This Container Version was updated.' } ).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 ด้านล่างเพื่อเรียกใช้เมธอดนี้กับข้อมูลแบบเรียลไทม์และดูการตอบสนอง