# Google Analytics Admin API . accounts

## Instance Methods

Returns the userLinks Resource.

Close httplib2 connections.

Marks target Account as soft-deleted (ie: "trashed") and returns it. This API does not have a method to restore soft-deleted accounts. However, they can be restored using the Trash Can UI. If the accounts are not restored before the expiration time, the account and all child resources (eg: Properties, GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found.

Lookup for a single Account. Throws "Target not found" if no such account found, or if caller does not have permissions to access it.

Get data sharing settings on an account. Data sharing settings are singletons.

Returns all accounts accessible by the caller. Note that these accounts might not currently have App+Web properties. Soft-deleted (ie: "trashed") accounts are excluded by default. Returns an empty list if no relevant accounts are found.

Retrieves the next page of results.

Updates an account.

Requests a ticket for creating an account.

### Method Details

`close()`

    Close httplib2 connections.

`delete(name, x__xgafv=None)`

    Marks target Account as soft-deleted (ie: "trashed") and returns it. This API does not have a method to restore soft-deleted accounts. However, they can be restored using the Trash Can UI. If the accounts are not restored before the expiration time, the account and all child resources (eg: Properties, GoogleAdsLinks, Streams, UserLinks) will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found.

    Args:
      name: string, Required. The name of the Account to soft-delete. Format: accounts/{account} Example: "accounts/100" (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)`

    Lookup for a single Account. Throws "Target not found" if no such account found, or if caller does not have permissions to access it.

    Args:
      name: string, Required. The name of the account to lookup. Format: accounts/{account} Example: "accounts/100" (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 Google Analytics account.
        "updateTime": "A String", # Output only. Time when account payload fields were last updated.
        "displayName": "A String", # Required. Human-readable display name for this account.
        "deleted": True or False, # Output only. Indicates whether this Account is soft-deleted or not. Deleted accounts are excluded from List results unless specifically requested.
        "name": "A String", # Output only. Resource name of this account. Format: accounts/{account} Example: "accounts/100"
        "countryCode": "A String", # Country of business. Must be a non-deprecated code for a UN M.49 region. https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html
        "createTime": "A String", # Output only. Time when this account was originally created.
      }

`getDataSharingSettings(name, x__xgafv=None)`

    Get data sharing settings on an account. Data sharing settings are singletons.

    Args:
      name: string, Required. The name of the settings to lookup. Format: accounts/{account}/dataSharingSettings Example: "accounts/1000/dataSharingSettings" (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 data sharing settings of a Google Analytics account.
        "sharingWithOthersEnabled": True or False, # Allows Google to share the data anonymously in aggregate form with others.
        "sharingWithGoogleProductsEnabled": True or False, # Allows Google to use the data to improve other Google products or services.
        "name": "A String", # Output only. Resource name. Format: accounts/{account}/dataSharingSettings Example: "accounts/1000/dataSharingSettings"
        "sharingWithGoogleAssignedSalesEnabled": True or False, # Allows Google sales teams that are assigned to the customer to access the data in order to suggest configuration changes to improve results. Sales team restrictions still apply when enabled.
        "sharingWithGoogleAnySalesEnabled": True or False, # Allows any of Google sales to access the data in order to suggest configuration changes to improve results.
        "sharingWithGoogleSupportEnabled": True or False, # Allows Google support to access the data in order to help troubleshoot issues.
      }

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

    Returns all accounts accessible by the caller. Note that these accounts might not currently have App+Web properties. Soft-deleted (ie: "trashed") accounts are excluded by default. Returns an empty list if no relevant accounts are found.

    Args:
      pageSize: integer, The maximum number of resources to return. The service may return fewer than this value, even if there are additional pages. If unspecified, at most 50 resources will be returned. The maximum value is 200; (higher values will be coerced to the maximum)
      showDeleted: boolean, Whether to include soft-deleted (ie: "trashed") Accounts in the results. Accounts can be inspected to determine whether they are deleted or not.
      pageToken: string, A page token, received from a previous `ListAccounts` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListAccounts` 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:

        { # Request message for ListAccounts RPC.
        "accounts": [ # Results that were accessible to the caller.
          { # A resource message representing a Google Analytics account.
            "updateTime": "A String", # Output only. Time when account payload fields were last updated.
            "displayName": "A String", # Required. Human-readable display name for this account.
            "deleted": True or False, # Output only. Indicates whether this Account is soft-deleted or not. Deleted accounts are excluded from List results unless specifically requested.
            "name": "A String", # Output only. Resource name of this account. Format: accounts/{account} Example: "accounts/100"
            "countryCode": "A String", # Country of business. Must be a non-deprecated code for a UN M.49 region. https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html
            "createTime": "A String", # Output only. Time when this account was originally created.
          },
        ],
        "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.
      }

`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, updateMask=None, x__xgafv=None)`

    Updates an account.

    Args:
      name: string, Output only. Resource name of this account. Format: accounts/{account} Example: "accounts/100" (required)
      body: object, The request body.
        The object takes the form of:

    { # A resource message representing a Google Analytics account.
      "updateTime": "A String", # Output only. Time when account payload fields were last updated.
      "displayName": "A String", # Required. Human-readable display name for this account.
      "deleted": True or False, # Output only. Indicates whether this Account is soft-deleted or not. Deleted accounts are excluded from List results unless specifically requested.
      "name": "A String", # Output only. Resource name of this account. Format: accounts/{account} Example: "accounts/100"
      "countryCode": "A String", # Country of business. Must be a non-deprecated code for a UN M.49 region. https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html
      "createTime": "A String", # Output only. Time when this account was originally created.
    }

      updateMask: string, The list of fields to be updated. Omitted fields will not be updated.
      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 Google Analytics account.
        "updateTime": "A String", # Output only. Time when account payload fields were last updated.
        "displayName": "A String", # Required. Human-readable display name for this account.
        "deleted": True or False, # Output only. Indicates whether this Account is soft-deleted or not. Deleted accounts are excluded from List results unless specifically requested.
        "name": "A String", # Output only. Resource name of this account. Format: accounts/{account} Example: "accounts/100"
        "countryCode": "A String", # Country of business. Must be a non-deprecated code for a UN M.49 region. https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html
        "createTime": "A String", # Output only. Time when this account was originally created.
      }

`provisionAccountTicket(body=None, x__xgafv=None)`

    Requests a ticket for creating an account.

    Args:
      body: object, The request body.
        The object takes the form of:

    { # Request message for ProvisionAccountTicket RPC.
        "redirectUri": "A String", # Redirect URI where the user will be sent after accepting Terms of Service. Must be configured in Developers Console as a Redirect URI
        "account": { # A resource message representing a Google Analytics account. # The account to create.
          "updateTime": "A String", # Output only. Time when account payload fields were last updated.
          "displayName": "A String", # Required. Human-readable display name for this account.
          "deleted": True or False, # Output only. Indicates whether this Account is soft-deleted or not. Deleted accounts are excluded from List results unless specifically requested.
          "name": "A String", # Output only. Resource name of this account. Format: accounts/{account} Example: "accounts/100"
          "countryCode": "A String", # Country of business. Must be a non-deprecated code for a UN M.49 region. https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html
          "createTime": "A String", # Output only. Time when this account was originally created.
        },
      }

      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 ProvisionAccountTicket RPC.
        "accountTicketId": "A String", # The param to be passed in the ToS link.
      }