نیاز به مجوز دارد
یک حساب GTM را به روز می کند. اکنون آن را امتحان کنید یا نمونه ای را ببینید .
درخواست
درخواست HTTP
PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId
مولفه های
نام پارامتر | ارزش | شرح |
---|---|---|
پارامترهای مسیر | ||
accountId | string | شناسه حساب GTM. |
پارامترهای پرس و جو اختیاری | ||
fingerprint | string | در صورت ارائه، این اثر انگشت باید با اثر انگشت حساب موجود در حافظه مطابقت داشته باشد. |
مجوز
این درخواست به مجوز با محدوده زیر نیاز دارد ( در مورد احراز هویت و مجوز بیشتر بخوانید ).
محدوده |
---|
https://www.googleapis.com/auth/tagmanager.manage.accounts |
درخواست بدن
در بدنه درخواست، یک منبع حسابها با ویژگیهای زیر ارائه کنید:
نام ملک | ارزش | شرح | یادداشت |
---|---|---|---|
ویژگی های اختیاری | |||
name | string | نام نمایشی حساب | قابل نوشتن |
shareData | boolean | اینکه آیا این حساب دادهها را بهصورت ناشناس با Google و دیگران به اشتراک میگذارد. | قابل نوشتن |
واکنش
در صورت موفقیت آمیز بودن، این روش یک منبع Accounts را در بدنه پاسخ باز می گرداند.
مثال ها
توجه: نمونههای کد موجود برای این روش همه زبانهای برنامهنویسی پشتیبانیشده را نشان نمیدهند (برای فهرست زبانهای پشتیبانیشده به صفحه کتابخانههای سرویس گیرنده مراجعه کنید).
جاوا
از کتابخانه سرویس گیرنده جاوا استفاده می کند.
/* * Note: This code assumes you have an authorized tagmanager service object. */ /* * This request updates an existing account for the authorized user. */ // Construct the account object Account account = new Account(); account.setName("Primary GTM Account"); account.setShareData(false); try { Account response = tagmanager.accounts().update("123456", account).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());
پایتون
از کتابخانه کلاینت پایتون استفاده می کند.
# Note: This code assumes you have an authorized tagmanager service object. # This request updates an existing account for the authorized user. try: response = tagmanager.accounts().update( accountId='123456', body={ 'name': 'Primary GTM Account', 'shareData': False } ).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')
آن را امتحان کنید!
از APIs Explorer زیر برای فراخوانی این روش در دادههای زنده و دیدن پاسخ استفاده کنید.