# Google Analytics Admin API . accounts . userLinks

## Instance Methods

Lists all user links on an account or property, including implicit ones that come from effective permissions granted by groups or organization admin roles. If a returned user link does not have direct permissions, they cannot be removed from the account or property directly with the DeleteUserLink command. They have to be removed from the group/etc that gives them permissions, which is currently only usable/discoverable in the GA or GMP UIs.

Retrieves the next page of results.

Creates information about multiple users' links to an account or property. This method is transactional. If any UserLink cannot be created, none of the UserLinks will be created.

Deletes information about multiple users' links to an account or property.

Gets information about multiple users' links to an account or property.

Updates information about multiple users' links to an account or property.

Close httplib2 connections.

Creates a user link on an account or property. If the user with the specified email already has permissions on the account or property, then the user's existing permissions will be unioned with the permissions specified in the new UserLink.

Deletes a user link on an account or property.

Gets information about a user's link to an account or property.

Lists all user links on an account or property.

Retrieves the next page of results.

Updates a user link on an account or property.

### Method Details

`audit(parent, body=None, x__xgafv=None)`

    Lists all user links on an account or property, including implicit ones that come from effective permissions granted by groups or organization admin roles. If a returned user link does not have direct permissions, they cannot be removed from the account or property directly with the DeleteUserLink command. They have to be removed from the group/etc that gives them permissions, which is currently only usable/discoverable in the GA or GMP UIs.

    Args:
      parent: string, Required. Example format: accounts/1234 (required)
      body: object, The request body.
        The object takes the form of:

    { # Request message for AuditUserLinks RPC.
        "pageSize": 42, # The maximum number of user links to return. The service may return fewer than this value. If unspecified, at most 1000 user links will be returned. The maximum value is 5000; values above 5000 will be coerced to 5000.
        "pageToken": "A String", # A page token, received from a previous `AuditUserLinks` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `AuditUserLinks` must match the call that provided the page token.
      }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Response message for AuditUserLinks RPC.
        "userLinks": [ # List of AuditUserLinks. These will be ordered stably, but in an arbitrary order.
          { # Read-only resource used to summarize a principal's effective roles.
            "effectiveRoles": [ # Union of all permissions a user has at this account or property (includes direct permissions, group-inherited permissions, etc.). Format: predefinedRoles/read
              "A String",
            ],
            "directRoles": [ # Roles directly assigned to this user for this entity. Format: predefinedRoles/read Excludes roles that are inherited from an account (if this is for a property), group, or organization admin role.
              "A String",
            ],
            "name": "A String", # Example format: properties/1234/userLinks/5678
            "emailAddress": "A String", # Email address of the linked user
          },
        ],
        "nextPageToken": "A String", # A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
      }

`audit_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.

`batchCreate(parent, body=None, x__xgafv=None)`

    Creates information about multiple users' links to an account or property. This method is transactional. If any UserLink cannot be created, none of the UserLinks will be created.

    Args:
      parent: string, Required. The account or property that all user links in the request are for. This field is required. The parent field in the CreateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234 (required)
      body: object, The request body.
        The object takes the form of:

    { # Request message for BatchCreateUserLinks RPC.
        "notifyNewUsers": True or False, # Optional. If notify_new_users is set, then email new users that they've been given permissions on the resource.
        "requests": [ # The requests specifying the user links to create. A maximum of 1000 user links can be created in a batch.
          { # Request message for CreateUserLink RPC. Users can have multiple email addresses associated with their Google account, and one of these email addresses is the "primary" email address. Any of the email addresses associated with a Google account may be used for a new UserLink, but the returned UserLink will always contain the "primary" email address. As a result, the input and output email address for this request may differ.
            "userLink": { # A resource message representing a user's permissions on an Account or Property resource. # Required. The user link to create.
              "directRoles": [ # Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/read predefinedRoles/collaborate predefinedRoles/edit predefinedRoles/manage-users Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
                "A String",
              ],
              "name": "A String", # Example format: properties/1234/userLinks/5678
              "emailAddress": "A String", # Email address of the user to link
            },
            "notifyNewUser": True or False, # Optional. If notify_new_user is set, then email new user that they've been given permissions on the resource.
            "parent": "A String", # Required. Example format: accounts/1234
          },
        ],
      }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Response message for BatchCreateUserLinks RPC.
        "userLinks": [ # The user links created.
          { # A resource message representing a user's permissions on an Account or Property resource.
            "directRoles": [ # Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/read predefinedRoles/collaborate predefinedRoles/edit predefinedRoles/manage-users Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
              "A String",
            ],
            "name": "A String", # Example format: properties/1234/userLinks/5678
            "emailAddress": "A String", # Email address of the user to link
          },
        ],
      }

`batchDelete(parent, body=None, x__xgafv=None)`

    Deletes information about multiple users' links to an account or property.

    Args:
      parent: string, Required. The account or property that all user links in the request are for. The parent of all values for user link names to delete must match this field. Example format: accounts/1234 (required)
      body: object, The request body.
        The object takes the form of:

    { # Request message for BatchDeleteUserLinks RPC.
        "requests": [ # The requests specifying the user links to update. A maximum of 1000 user links can be updated in a batch.
          { # Request message for DeleteUserLink RPC.
            "name": "A String", # Required. Example format: accounts/1234/userLinks/5678
          },
        ],
      }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.
      }

`batchGet(parent, names=None, x__xgafv=None)`

    Gets information about multiple users' links to an account or property.

    Args:
      parent: string, Required. The account or property that all user links in the request are for. The parent of all provided values for the 'names' field must match this field. Example format: accounts/1234 (required)
      names: string, Required. The names of the user links to retrieve. A maximum of 1000 user links can be retrieved in a batch. Format: accounts/{accountId}/userLinks/{userLinkId} (repeated)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Response message for BatchGetUserLinks RPC.
        "userLinks": [ # The requested user links.
          { # A resource message representing a user's permissions on an Account or Property resource.
            "directRoles": [ # Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/read predefinedRoles/collaborate predefinedRoles/edit predefinedRoles/manage-users Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
              "A String",
            ],
            "name": "A String", # Example format: properties/1234/userLinks/5678
            "emailAddress": "A String", # Email address of the user to link
          },
        ],
      }

`batchUpdate(parent, body=None, x__xgafv=None)`

    Updates information about multiple users' links to an account or property.

    Args:
      parent: string, Required. The account or property that all user links in the request are for. The parent field in the UpdateUserLinkRequest messages must either be empty or match this field. Example format: accounts/1234 (required)
      body: object, The request body.
        The object takes the form of:

    { # Request message for BatchUpdateUserLinks RPC.
        "requests": [ # The requests specifying the user links to update. A maximum of 1000 user links can be updated in a batch.
          { # Request message for UpdateUserLink RPC.
            "userLink": { # A resource message representing a user's permissions on an Account or Property resource. # Required. The user link to update.
              "directRoles": [ # Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/read predefinedRoles/collaborate predefinedRoles/edit predefinedRoles/manage-users Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
                "A String",
              ],
              "name": "A String", # Example format: properties/1234/userLinks/5678
              "emailAddress": "A String", # Email address of the user to link
            },
          },
        ],
      }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Response message for BatchUpdateUserLinks RPC.
        "userLinks": [ # The user links updated.
          { # A resource message representing a user's permissions on an Account or Property resource.
            "directRoles": [ # Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/read predefinedRoles/collaborate predefinedRoles/edit predefinedRoles/manage-users Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
              "A String",
            ],
            "name": "A String", # Example format: properties/1234/userLinks/5678
            "emailAddress": "A String", # Email address of the user to link
          },
        ],
      }

`close()`

    Close httplib2 connections.

`create(parent, body=None, notifyNewUser=None, x__xgafv=None)`

    Creates a user link on an account or property. If the user with the specified email already has permissions on the account or property, then the user's existing permissions will be unioned with the permissions specified in the new UserLink.

    Args:
      parent: string, Required. Example format: accounts/1234 (required)
      body: object, The request body.
        The object takes the form of:

    { # A resource message representing a user's permissions on an Account or Property resource.
      "directRoles": [ # Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/read predefinedRoles/collaborate predefinedRoles/edit predefinedRoles/manage-users Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
        "A String",
      ],
      "name": "A String", # Example format: properties/1234/userLinks/5678
      "emailAddress": "A String", # Email address of the user to link
    }

      notifyNewUser: boolean, Optional. If notify_new_user is set, then email new user that they've been given permissions on the resource.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A resource message representing a user's permissions on an Account or Property resource.
        "directRoles": [ # Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/read predefinedRoles/collaborate predefinedRoles/edit predefinedRoles/manage-users Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
          "A String",
        ],
        "name": "A String", # Example format: properties/1234/userLinks/5678
        "emailAddress": "A String", # Email address of the user to link
      }

`delete(name, x__xgafv=None)`

    Deletes a user link on an account or property.

    Args:
      name: string, Required. Example format: accounts/1234/userLinks/5678 (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.
      }

`get(name, x__xgafv=None)`

    Gets information about a user's link to an account or property.

    Args:
      name: string, Required. Example format: accounts/1234/userLinks/5678 (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A resource message representing a user's permissions on an Account or Property resource.
        "directRoles": [ # Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/read predefinedRoles/collaborate predefinedRoles/edit predefinedRoles/manage-users Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
          "A String",
        ],
        "name": "A String", # Example format: properties/1234/userLinks/5678
        "emailAddress": "A String", # Email address of the user to link
      }

`list(parent, pageToken=None, pageSize=None, x__xgafv=None)`

    Lists all user links on an account or property.

    Args:
      parent: string, Required. Example format: accounts/1234 (required)
      pageToken: string, A page token, received from a previous `ListUserLinks` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListUserLinks` must match the call that provided the page token.
      pageSize: integer, The maximum number of user links to return. The service may return fewer than this value. If unspecified, at most 200 user links will be returned. The maximum value is 500; values above 500 will be coerced to 500.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Response message for ListUserLinks RPC.
        "nextPageToken": "A String", # A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
        "userLinks": [ # List of UserLinks. These will be ordered stably, but in an arbitrary order.
          { # A resource message representing a user's permissions on an Account or Property resource.
            "directRoles": [ # Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/read predefinedRoles/collaborate predefinedRoles/edit predefinedRoles/manage-users Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
              "A String",
            ],
            "name": "A String", # Example format: properties/1234/userLinks/5678
            "emailAddress": "A String", # Email address of the user to link
          },
        ],
      }

`list_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.

`patch(name, body=None, x__xgafv=None)`

    Updates a user link on an account or property.

    Args:
      name: string, Example format: properties/1234/userLinks/5678 (required)
      body: object, The request body.
        The object takes the form of:

    { # A resource message representing a user's permissions on an Account or Property resource.
      "directRoles": [ # Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/read predefinedRoles/collaborate predefinedRoles/edit predefinedRoles/manage-users Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
        "A String",
      ],
      "name": "A String", # Example format: properties/1234/userLinks/5678
      "emailAddress": "A String", # Email address of the user to link
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A resource message representing a user's permissions on an Account or Property resource.
        "directRoles": [ # Roles directly assigned to this user for this account or property. Valid values: predefinedRoles/read predefinedRoles/collaborate predefinedRoles/edit predefinedRoles/manage-users Excludes roles that are inherited from a higher-level entity, group, or organization admin role. A UserLink that is updated to have an empty list of direct_roles will be deleted.
          "A String",
        ],
        "name": "A String", # Example format: properties/1234/userLinks/5678
        "emailAddress": "A String", # Email address of the user to link
      }