需要授权
请求
HTTP 请求
PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId/containers/containerId/versions/containerVersionId
参数
参数名称 | 值 | 说明 |
---|---|---|
路径参数 | ||
accountId |
string |
GTM 帐号 ID。 |
containerId |
string |
GTM 容器 ID。 |
containerVersionId |
string |
GTM 容器版本 ID。 |
可选查询参数 | ||
fingerprint |
string |
此指纹(如果提供)必须与所存储容器版本的指纹匹配。 |
授权
此请求需要获得下列范围的授权(详细了解身份验证和授权)。
范围 |
---|
https://www.googleapis.com/auth/tagmanager.edit.containerversions |
请求正文
在请求正文中,提供具有以下属性的 Container Versions 资源:
属性名称 | 值 | 说明 | 备注 |
---|---|---|---|
可选属性 | |||
name |
string |
容器版本显示名。 | 可写入 |
notes |
string |
有关如何在容器中应用此容器版本的用户注释。 | 可写入 |
响应
如果成功,此方法会在响应正文中返回 Container Versions 资源。
示例
备注:此方法的代码示例并未列出所有受支持的编程语言(请参阅客户端库页面,查看受支持的语言列表)。
Java
使用 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
使用 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 针对实际数据调用此方法,并查看响应。