Permissions: update

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

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

अनुरोध

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

PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId/permissions/permissionId

पैरामीटर

पैरामीटर का नाम वैल्यू ब्यौरा
पाथ पैरामीटर
accountId string GTM खाता आईडी.
permissionId string GTM यूज़र आईडी.

अनुमति देना

इस अनुरोध के लिए नीचे दिए गए दायरे के साथ अनुमति की ज़रूरत है (पुष्टि करने और अनुमति देने के बारे में ज़्यादा पढ़ें).

स्कोप
https://www.googleapis.com/auth/tagmanager.manage.users

अनुरोध का मुख्य भाग

अनुरोध के मुख्य हिस्से में, इन प्रॉपर्टी के साथ अनुमतियों से जुड़ा संसाधन दें:

प्रॉपर्टी का नाम वैल्यू ब्यौरा ज़रूरी जानकारी
वैकल्पिक प्रॉपर्टी
accountAccess nested object GTM खाते के ऐक्सेस की अनुमतियां. लिखने योग्य
accountAccess.permission[] list खाता अनुमतियों की सूची. खाते की मान्य अनुमतियां read और manage हैं. लिखने योग्य
containerAccess[] list GTM कंटेनर ऐक्सेस की अनुमतियां. लिखने योग्य
containerAccess[].containerId string GTM कंटेनर आईडी. लिखने योग्य
containerAccess[].permission[] list कंटेनर की अनुमतियों की सूची. कंटेनर के लिए सही अनुमतियां हैं: read, edit, delete, publish. लिखने योग्य

जवाब

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

उदाहरण

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

Java

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

/*
 * Note: This code assumes you have an authorized tagmanager service object.
 */

/*
 * This request updates a user's permissions to access a GTM account.
 */

// Construct the container access object.
ContainerAccess container = new ContainerAccess();
container.setContainerId("789443");
container.setPermission(Arrays.asList("read"));

// Construct the account access object.
AccountAccess account = new AccountAccess();
account.setPermission(Arrays.asList("read"));

// Construct the user access object.
UserAccess userAccess = new UserAccess();
userAccess.setEmailAddress("username@example.com");
userAccess.setAccountAccess(account);
userAccess.setContainerAccess(Arrays.asList(container));

try {
  UserAccess response = tagmanager.accounts().
      permissions().update("123456", "00123456789", userAccess).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 a user's permissions to access a GTM account.
try:
  response = tagmanager.accounts().permissions().update(
      accountId='123456',
      permissionId='00123456789',
      body={
          'emailAddress': 'username@example.com',
          'accountAccess': {
              'permission': [
                  'read'
              ]
          },
          'containerAccess': {
              'containerId': '54321',
              'permission': [
                  'read'
              ]
          }
      }
  ).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')

इसे आज़माएं!

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