Accounts: update

इसके लिए, अनुमति लेना ज़रूरी है

GTM खाते को अपडेट करता है. इसे अभी आज़माएं या उदाहरण देखें.

अनुरोध

एचटीटीपी अनुरोध

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 और अन्य लोगों के साथ डेटा शेयर करता है या नहीं. लिखने योग्य

जवाब

कामयाब होने पर, यह तरीका रिस्पॉन्स के मुख्य हिस्से में खाते का रिसॉर्स दिखाता है.

उदाहरण

ध्यान दें: इस तरीके के लिए दिए गए कोड के उदाहरणों में इसके साथ काम करने वाली सभी प्रोग्रामिंग भाषाएं नहीं दिखाई गई हैं (इसके साथ काम करने वाली भाषाओं की सूची के लिए क्लाइंट लाइब्रेरी वाला पेज देखें).

Java

Java क्लाइंट लाइब्रेरी का इस्तेमाल करता है.

/*
 * 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());

Python

Python क्लाइंट लाइब्रेरी का इस्तेमाल करता हो.

# 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')

इसे आज़माएं!

इस तरीके को लाइव डेटा पर कॉल करने और रिस्पॉन्स देखने के लिए, नीचे दिए गए एपीआई एक्सप्लोरर का इस्तेमाल करें.