Container Versions: publish

ต้องมีการให้สิทธิ์

นำเวอร์ชันคอนเทนเนอร์ไปใช้จริง ลองใช้เลยหรือดูตัวอย่าง

ส่งคำขอ

คำขอ HTTP

POST https://www.googleapis.com/tagmanager/v1/accounts/accountId/containers/containerId/versions/containerVersionId/publish

พารามิเตอร์

ชื่อพารามิเตอร์ ค่า คำอธิบาย
พารามิเตอร์เส้นทาง
accountId string รหัสบัญชี GTM
containerId string รหัสคอนเทนเนอร์ GTM
containerVersionId string รหัสเวอร์ชันคอนเทนเนอร์ GTM
พารามิเตอร์การค้นหาที่ไม่บังคับ
fingerprint string หากระบุ ลายนิ้วมือนี้ต้องตรงกับลายนิ้วมือของเวอร์ชันคอนเทนเนอร์ในพื้นที่เก็บข้อมูล

การให้สิทธิ์

คำขอนี้ต้องได้รับสิทธิ์ด้วยขอบเขตต่อไปนี้ (อ่านเพิ่มเติมเกี่ยวกับการตรวจสอบสิทธิ์และการให้สิทธิ์)

ขอบเขต
https://www.googleapis.com/auth/tagmanager.publish

เนื้อหาของคำขอ

โปรดอย่าแสดงเนื้อหาของคำขอด้วยวิธีนี้

คำตอบ

หากสำเร็จ เมธอดนี้จะแสดงเนื้อหาการตอบสนองที่มีโครงสร้างต่อไปนี้

{
  "containerVersion": accounts.containers.versions Resource,
  "compilerError": boolean
}
ชื่อพร็อพเพอร์ตี้ ค่า คำอธิบาย Notes
containerVersion nested object เวอร์ชันคอนเทนเนอร์ที่สร้าง
compilerError boolean คอมไพเลอร์มีข้อผิดพลาดหรือไม่

ตัวอย่าง

หมายเหตุ: ตัวอย่างโค้ดที่มีสำหรับวิธีการนี้ไม่ได้แสดงถึงภาษาโปรแกรมที่รองรับทั้งหมด (ดูรายการภาษาที่รองรับได้ในหน้าไลบรารีของไคลเอ็นต์)

Java

ใช้ไลบรารีของไคลเอ็นต์ Java

/*
 * Note: This code assumes you have an authorized tagmanager service object.
 */

/*
 * This request publishes a container version.
 */
try {
  tagmanager.accounts().containers().
      versions().publish("123456", "54321", "2").execute();
} catch (GoogleJsonResponseException e) {
  System.err.println("There was a service error: "
      + e.getDetails().getCode() + " : "
      + e.getDetails().getMessage());
}

Python

ใช้ไลบรารีของไคลเอ็นต์ Python

# Note: This code assumes you have an authorized tagmanager service object.

# This request publishes a container version.
try:
  tagmanager.accounts().containers().versions().publish(
      accountId='123456',
      containerId='54321',
      containerVersionId='2'
  ).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))

ลองใช้เลย

ใช้ API Explorer ด้านล่างเพื่อเรียกใช้เมธอดนี้กับข้อมูลแบบเรียลไทม์และดูการตอบสนอง