Profile Filter Links: patch

需要授权

更新现有的配置文件过滤器关联。此方法支持修补语义。立即试用查看示例

请求

HTTP 请求

PATCH https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/profiles/profileId/profileFilterLinks/linkId

参数

参数名称 说明
路径参数
accountId string 配置文件过滤器关联所属的帐号 ID。
linkId string 要更新的配置文件过滤器关联的 ID。
profileId string 过滤器关联所属的配置文件 ID
webPropertyId string 配置文件过滤器关联所属的网络媒体资源 ID

授权

此请求需要获得下列范围的授权(详细了解身份验证和授权)。

范围
https://www.googleapis.com/auth/analytics.edit

请求正文

在请求正文中,根据修补语义的规则提供“配置文件过滤器关联”资源的相关部分。

响应

如果成功,此方法将在响应正文中返回一个“配置文件过滤器关联”资源

示例

注意:此方法的代码示例并未列出所有受支持的编程语言(请参阅客户端库页面,查看受支持的语言列表)。

Java

使用 Java 客户端库

/*
 * Note: This code assumes you have an authorized Analytics service object.
 * See the Filters Developer Guide for details.
 */

/*
 * This request patches an existing profile filter link.
 */

// Construct the filter reference.
FilterRef filterRef = new FilterRef();
filterRef.setId("1223334444");

// Construct the body of the request.
ProfileFilterLink body = new ProfileFilterLink();
body.setFilterRef(filterRef);

try {
analytics.management().profileFilterLinks().patch("123456",
    "UA-123456-1", "7654321", "1122334455", body).execute();
} catch (GoogleJsonResponseException e) {
  System.err.println("There was a service error: "
      + e.getDetails().getCode() + " : "
      + e.getDetails().getMessage());
}

Python

使用 Python 客户端库

# Note: This code assumes you have an authorized Analytics service object.
# See the Filters Developer Guide for details.

# This request patches an existing profile filter link.
try:
  analytics.management().profileFilterLinks().patch(
      accountId='123456',
      webPropertyId='UA-123456-1',
      profileId='7654321',
      linkId='11223344',
      body={
          'filterRef': {
              'id': '1223334444'
              }
      }
  ).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))

试试看!

请使用下面的 API Explorer 对实际数据调用此方法,并查看响应。或者,您也可以尝试使用独立的 Explorer