Permissions: list

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

खाते का ऐक्सेस रखने वाले सभी उपयोगकर्ताओं की सूची बनाएं. साथ ही, उन्हें दी गई खाता और कंटेनर की अनुमतियां भी डालें. इसे अभी आज़माएं या उदाहरण देखें.

अनुरोध

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

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

पैरामीटर

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

अनुमति देना

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

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

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

इस तरीके का इस्तेमाल करके, अनुरोध का मुख्य हिस्सा न दें.

जवाब

कामयाब होने पर, यह तरीका इस स्ट्रक्चर के साथ रिस्पॉन्स का मुख्य हिस्सा दिखाता है:

{
  "userAccess": [
    accounts.permissions Resource
  ]
}
प्रॉपर्टी का नाम वैल्यू ब्यौरा ज़रूरी जानकारी
userAccess[] list GTM खाते के सभी GTM Accountउपयोगकर्ता.

उदाहरण

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

Java

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

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

/*
 * This request lists all permissions for the authorized user.
 */
try {
  ListAccountUsersResponse permissions =
      tagmanager.accounts().permissions().list("123456").execute();
} catch (GoogleJsonResponseException e) {
  System.err.println("There was a service error: "
      + e.getDetails().getCode() + " : "
      + e.getDetails().getMessage());
}

/*
 * The results of the list method are stored in the permissions object.
 * The following code shows how to iterate through them.
 */
for (UserAccess userAccess : permissions.getUserAccess()) {
  System.out.println("Account Id = " + userAccess.getAccountId());
  System.out.println("Permission Id = " + userAccess.getPermissionId());
  System.out.println("Email Address = " + userAccess.getEmailAddress());

  AccountAccess account = userAccess.getAccountAccess();
  for (String permission : account.getPermission()) {
    System.out.println("Account Permission = " + permission);
  }

  for (ContainerAccess container : userAccess.getContainerAccess()) {
    System.out.println("Container Id = " + container.getContainerId());
    for (String permission : account.getPermission()) {
      System.out.println("Container Permission = " + permission);
    }
  }
}

Python

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

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

# This request lists all permissions for the authorized user.
try:
  permissions = tagmanager.accounts().permissions().list(
      accountId='123456').execute()
  print permissions
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 list method are stored in the permissions object.
# The following code shows how to iterate through them.
for userAccess in permissions.get('userAccess', []):
  print 'Account Id = %s' % userAccess.get('accountId')
  print 'Permissions Id = %s' % userAccess.get('permissionId')
  print 'Email Address = %s' % userAccess.get('emailAddress')

  account = userAccess.get('accountAccess', {})
  for permission in account.get('permission', []):
    print 'Account Permission = %s' % permission

  for container in userAccess.get('containerAccess', []):
    print 'Container Id = %s' % container.get('containerId')
    for permission in container.get('permission', []):
      print 'Container Permission = %s' % permission

इसे आज़माएं!

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