Container Versions: update

認証が必要です

コンテナのバージョンを更新します。今すぐ試すまたは例を見る

リクエスト

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 を使用して、ライブデータに対してこのメソッドを呼び出し、レスポンスを確認してください。