يجب تقديم تفويض
تُعدِّل أذونات الحاوية والحساب للمستخدم. جرِّبه الآن أو شاهد مثالاً.
الطلب
طلب HTTP
PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId/permissions/permissionId
المَعلمات
اسم المعلَمة | القيمة | الوصف |
---|---|---|
مَعلمات المسار | ||
accountId |
string |
رقم تعريف حساب "إدارة العلامات من Google". |
permissionId |
string |
رقم تعريف المستخدم في "إدارة العلامات من Google". |
التفويض
يتطلب هذا الطلب تفويضًا من خلال النطاق التالي (مزيد من المعلومات حول المصادقة والترخيص).
النطاق |
---|
https://www.googleapis.com/auth/tagmanager.manage.users |
نص الطلب
في نص الطلب، يمكنك توفير مورد الأذونات بالسمات التالية:
اسم الموقع | القيمة | الوصف | Notes |
---|---|---|---|
الخصائص الاختيارية | |||
accountAccess |
nested object |
أذونات الوصول إلى حساب "إدارة العلامات من Google" | قابل للكتابة |
accountAccess.permission[] |
list |
قائمة أذونات الحساب أذونات الحساب الصالحة هما read وmanage . |
قابل للكتابة |
containerAccess[] |
list |
أذونات الوصول إلى حاوية Google Tag Manager | قابل للكتابة |
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')
تجربة
يمكنك استخدام مستكشف واجهات برمجة التطبيقات أدناه لطلب هذه الطريقة على البيانات المباشرة والاطّلاع على الاستجابة.