需要授权
请求
HTTP 请求
GET https://www.googleapis.com/tagmanager/v1/accounts/accountId/containers/containerId
参数
参数名称 | 值 | 说明 |
---|---|---|
路径参数 | ||
accountId |
string |
GTM 帐号 ID。 |
containerId |
string |
GTM 容器 ID。 |
授权
此请求至少需要获得以下任一范围的授权(详细了解身份验证和授权)。
范围 |
---|
https://www.googleapis.com/auth/tagmanager.readonly |
https://www.googleapis.com/auth/tagmanager.edit.containers |
请求正文
请勿使用此方法提供请求正文。
响应
如果成功,此方法会在响应正文中返回 Containers 资源。
示例
备注:此方法的代码示例并未列出所有受支持的编程语言(请参阅客户端库页面,查看受支持的语言列表)。
Java
使用 Java 客户端库。
/* * Note: This code assumes you have an authorized tagmanager service object. */ /* * This request gets an existing container for the authorized user. */ try { Container container = tagmanager.accounts(). containers().get("123456", "54321").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 gets an existing container. try: response = tagmanager.accounts().containers().get( accountId='123456', containerId='54321' ).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 针对实际数据调用此方法,并查看响应。