GetLinkedAccountsAndCustomersInfo 服务操作 - 客户管理

获取指定客户下的客户和帐户层次结构。

请求元素

GetLinkedAccountsAndCustomersInfoRequest 对象定义服务操作请求的正文标头元素。 元素的顺序必须与 请求 SOAP 中所示的顺序相同。

注意

除非下面另有说明,否则需要所有请求元素。

请求正文元素

元素 说明 数据类型
CustomerId 要获取其层次结构的客户标识符。 long
OnlyParentAccounts 确定是仅返回属于客户的广告客户帐户,还是还返回其他客户下的链接客户和链接广告客户帐户。

若要将结果限制为直接在指定客户下的广告客户帐户,请将此元素设置为 true,否则将其留空或将 属性设置为 false。 默认值为 false
boolean

请求标头元素

元素 说明 数据类型
AuthenticationToken OAuth 访问令牌,表示有权Microsoft广告帐户的用户的凭据。

有关详细信息,请参阅 使用 OAuth 进行身份验证
string
DeveloperToken 用于访问必应广告 API 的开发人员令牌。

有关详细信息,请参阅 获取开发人员令牌
string
Password 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 string
UserName 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 string

响应元素

GetLinkedAccountsAndCustomersInfoResponse 对象定义服务操作响应的正文标头元素。 元素的返回顺序与 响应 SOAP 中所示的顺序相同。

响应正文元素

元素 说明 数据类型
AccountsInfo 与请求条件匹配的广告客户帐户的信息列表。

请注意,从创建帐户到响应中包括帐户信息之前,最长可能会延迟 5 分钟。
AccountInfo 数组
CustomersInfo 有关符合请求条件的客户的信息列表。 CustomerInfo 数组

响应标头元素

元素 说明 数据类型
跟踪 ID 包含 API 调用详细信息的日志条目的标识符。 string

请求 SOAP

此模板由一个工具生成,用于显示 SOAP 请求的正文标头元素的顺序。 有关可用于此服务操作的支持类型,请参阅上面的 请求正文元素 参考。

<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/Customer/v13">
    <Action mustUnderstand="1">GetLinkedAccountsAndCustomersInfo</Action>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
  </s:Header>
  <s:Body>
    <GetLinkedAccountsAndCustomersInfoRequest xmlns="https://bingads.microsoft.com/Customer/v13">
      <CustomerId i:nil="false">ValueHere</CustomerId>
      <OnlyParentAccounts>ValueHere</OnlyParentAccounts>
    </GetLinkedAccountsAndCustomersInfoRequest>
  </s:Body>
</s:Envelope>

响应 SOAP

此模板由一个工具生成,用于显示 SOAP 响应的 正文标头 元素的顺序。

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/Customer/v13">
    <TrackingId d3p1:nil="false" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance">ValueHere</TrackingId>
  </s:Header>
  <s:Body>
    <GetLinkedAccountsAndCustomersInfoResponse xmlns="https://bingads.microsoft.com/Customer/v13">
      <AccountsInfo xmlns:e39="https://bingads.microsoft.com/Customer/v13/Entities" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e39:AccountInfo>
          <e39:Id>ValueHere</e39:Id>
          <e39:Name d4p1:nil="false">ValueHere</e39:Name>
          <e39:Number d4p1:nil="false">ValueHere</e39:Number>
          <e39:AccountLifeCycleStatus>ValueHere</e39:AccountLifeCycleStatus>
          <e39:PauseReason d4p1:nil="false">ValueHere</e39:PauseReason>
        </e39:AccountInfo>
      </AccountsInfo>
      <CustomersInfo xmlns:e40="https://bingads.microsoft.com/Customer/v13/Entities" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e40:CustomerInfo>
          <e40:Id d4p1:nil="false">ValueHere</e40:Id>
          <e40:Name d4p1:nil="false">ValueHere</e40:Name>
        </e40:CustomerInfo>
      </CustomersInfo>
    </GetLinkedAccountsAndCustomersInfoResponse>
  </s:Body>
</s:Envelope>

代码语法

示例语法可用于 必应广告 SDK。 有关更多示例,请参阅 必应广告 API 代码示例

public async Task<GetLinkedAccountsAndCustomersInfoResponse> GetLinkedAccountsAndCustomersInfoAsync(
	long? customerId,
	bool onlyParentAccounts)
{
	var request = new GetLinkedAccountsAndCustomersInfoRequest
	{
		CustomerId = customerId,
		OnlyParentAccounts = onlyParentAccounts
	};

	return (await CustomerManagementService.CallAsync((s, r) => s.GetLinkedAccountsAndCustomersInfoAsync(r), request));
}
static GetLinkedAccountsAndCustomersInfoResponse getLinkedAccountsAndCustomersInfo(
	java.lang.Long customerId,
	boolean onlyParentAccounts) throws RemoteException, Exception
{
	GetLinkedAccountsAndCustomersInfoRequest request = new GetLinkedAccountsAndCustomersInfoRequest();

	request.setCustomerId(customerId);
	request.setOnlyParentAccounts(onlyParentAccounts);

	return CustomerManagementService.getService().getLinkedAccountsAndCustomersInfo(request);
}
static function GetLinkedAccountsAndCustomersInfo(
	$customerId,
	$onlyParentAccounts)
{

	$GLOBALS['Proxy'] = $GLOBALS['CustomerManagementProxy'];

	$request = new GetLinkedAccountsAndCustomersInfoRequest();

	$request->CustomerId = $customerId;
	$request->OnlyParentAccounts = $onlyParentAccounts;

	return $GLOBALS['CustomerManagementProxy']->GetService()->GetLinkedAccountsAndCustomersInfo($request);
}
response=customermanagement_service.GetLinkedAccountsAndCustomersInfo(
	CustomerId=CustomerId,
	OnlyParentAccounts=OnlyParentAccounts)

要求

服务: CustomerManagementService.svc v13
命名空间: https://bingads.microsoft.com/Customer/v13

请求 URL

https://clientcenter.api.bingads.microsoft.com/CustomerManagement/v13/LinkedAccountsAndCustomersInfo/Query

请求元素

GetLinkedAccountsAndCustomersInfoRequest 对象定义服务操作请求的正文标头元素。

注意

除非下面另有说明,否则需要所有请求元素。

请求正文元素

元素 说明 数据类型
CustomerId 要获取其层次结构的客户标识符。 long
OnlyParentAccounts 确定是仅返回属于客户的广告客户帐户,还是还返回其他客户下的链接客户和链接广告客户帐户。

若要将结果限制为直接在指定客户下的广告客户帐户,请将此元素设置为 true,否则将其留空或将 属性设置为 false。 默认值为 false
boolean

请求标头元素

元素 说明 数据类型
Authorization OAuth 访问令牌,表示有权Microsoft广告帐户的用户的凭据。 请确保令牌的前缀为“持有者”,这是正确身份验证所必需的。

有关详细信息,请参阅 使用 OAuth 进行身份验证
string
DeveloperToken 用于访问必应广告 API 的开发人员令牌。

有关详细信息,请参阅 获取开发人员令牌
string
Password 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 string
UserName 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 string

响应元素

GetLinkedAccountsAndCustomersInfoResponse 对象定义服务操作响应的正文标头元素。 元素的返回顺序与 响应 JSON 中所示的顺序相同。

响应正文元素

元素 说明 数据类型
AccountsInfo 与请求条件匹配的广告客户帐户的信息列表。

请注意,从创建帐户到响应中包括帐户信息之前,最长可能会延迟 5 分钟。
AccountInfo 数组
CustomersInfo 有关符合请求条件的客户的信息列表。 CustomerInfo 数组

响应标头元素

元素 说明 数据类型
跟踪 ID 包含 API 调用详细信息的日志条目的标识符。 string

请求 JSON

此模板由显示 JSON 请求的 正文标头 元素的工具生成。 有关可用于此服务操作的支持类型,请参阅上面的 请求正文元素 参考。

{
  "CustomerId": "LongValueHere",
  "OnlyParentAccounts": "ValueHere"
}

响应 JSON

此模板由一个工具生成,用于显示 JSON 响应的 正文标头 元素。

{
  "AccountsInfo": [
    {
      "AccountLifeCycleStatus": "ValueHere",
      "Id": "LongValueHere",
      "Name": "ValueHere",
      "Number": "ValueHere",
      "PauseReason": "ValueHere"
    }
  ],
  "CustomersInfo": [
    {
      "Id": "LongValueHere",
      "Name": "ValueHere"
    }
  ]
}

代码语法

若要通过 SDK 调用 REST API,需要将 SDK 升级到特定版本并配置系统参数。示例语法可用于 必应广告 SDK。 有关更多示例,请参阅 必应广告 API 代码示例

public async Task<GetLinkedAccountsAndCustomersInfoResponse> GetLinkedAccountsAndCustomersInfoAsync(
	long? customerId,
	bool onlyParentAccounts)
{
	var request = new GetLinkedAccountsAndCustomersInfoRequest
	{
		CustomerId = customerId,
		OnlyParentAccounts = onlyParentAccounts
	};

	return (await CustomerManagementService.CallAsync((s, r) => s.GetLinkedAccountsAndCustomersInfoAsync(r), request));
}
static GetLinkedAccountsAndCustomersInfoResponse getLinkedAccountsAndCustomersInfo(
	java.lang.Long customerId,
	boolean onlyParentAccounts) throws RemoteException, Exception
{
	GetLinkedAccountsAndCustomersInfoRequest request = new GetLinkedAccountsAndCustomersInfoRequest();

	request.setCustomerId(customerId);
	request.setOnlyParentAccounts(onlyParentAccounts);

	return CustomerManagementService.getService().getLinkedAccountsAndCustomersInfo(request);
}
static function GetLinkedAccountsAndCustomersInfo(
	$customerId,
	$onlyParentAccounts)
{

	$GLOBALS['Proxy'] = $GLOBALS['CustomerManagementProxy'];

	$request = new GetLinkedAccountsAndCustomersInfoRequest();

	$request->CustomerId = $customerId;
	$request->OnlyParentAccounts = $onlyParentAccounts;

	return $GLOBALS['CustomerManagementProxy']->GetService()->GetLinkedAccountsAndCustomersInfo($request);
}
response=customermanagement_service.GetLinkedAccountsAndCustomersInfo(
	CustomerId=CustomerId,
	OnlyParentAccounts=OnlyParentAccounts)