Edit

Share via


FindAccounts Service Operation - Customer Management

Gets a list of accounts owned by the specified customer that match the specified filter criteria.

Request Elements

The FindAccountsRequest object defines the body and header elements of the service operation request. The elements must be in the same order as shown in the Request SOAP.

Note

Unless otherwise noted below, all request elements are required.

Request Body Elements

Element Description Data Type
AccountFilter The criteria to use to filter the list of accounts. You can specify either an account name or an account number. If your filter value is of the form, Xnnnnn, where nnnnn is a series of digits, the operation filters by account number.

The filter value can contain a partial or full account name or number of the accounts that you want to get. The operation includes the account in the result if the name or number of the account begins with the specified filter value.

The operation performs a case-insensitive comparison when it compares your filter value to the account name or number. For example, if you specify "t" as the filter value, the list will include accounts whose names begin with "t" or "T".

Setting this element to an empty string is the same as calling the GetAccountsInfo.
string
CustomerId The identifier of the customer whose accounts you want to get.

If null, the operation searches for a match among all of the accounts of the customers that the user manages and owns.
long
TopN A nonzero positive integer that specifies the number of accounts to return in the result. You must specify a value from 1 through 5,000. int

Request Header Elements

Element Description Data Type
AuthenticationToken The OAuth access token that represents the credentials of a user who has permissions to Microsoft Advertising accounts.

For more information see Authentication with OAuth.
string
DeveloperToken The developer token used to access the Bing Ads API.

For more information see Get a Developer Token.
string
Password This element is reserved for internal use and will be removed from a future version of the API. You must use the AuthenticationToken element to set user credentials. string
UserName This element is reserved for internal use and will be removed from a future version of the API. You must use the AuthenticationToken element to set user credentials. string

Response Elements

The FindAccountsResponse object defines the body and header elements of the service operation response. The elements are returned in the same order as shown in the Response SOAP.

Response Body Elements

Element Description Data Type
AccountsInfo A list of AccountInfo objects of the accounts that match the specified filter criteria.

To get the complete details of an account in the list, access the Id element of the AccountInfo object and use it to call GetAccount.
AccountInfo array

Response Header Elements

Element Description Data Type
TrackingId The identifier of the log entry that contains the details of the API call. string

Request SOAP

This template was generated by a tool to show the order of the body and header elements for the SOAP request. For supported types that you can use with this service operation, see the Request Body Elements reference above.

<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">FindAccounts</Action>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
  </s:Header>
  <s:Body>
    <FindAccountsRequest xmlns="https://bingads.microsoft.com/Customer/v13">
      <CustomerId i:nil="false">ValueHere</CustomerId>
      <AccountFilter i:nil="false">ValueHere</AccountFilter>
      <TopN>ValueHere</TopN>
    </FindAccountsRequest>
  </s:Body>
</s:Envelope>

Response SOAP

This template was generated by a tool to show the order of the body and header elements for the SOAP response.

<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>
    <FindAccountsResponse xmlns="https://bingads.microsoft.com/Customer/v13">
      <AccountsInfo xmlns:e226="https://bingads.microsoft.com/Customer/v13/Entities" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e226:AccountInfo>
          <e226:Id>ValueHere</e226:Id>
          <e226:Name d4p1:nil="false">ValueHere</e226:Name>
          <e226:Number d4p1:nil="false">ValueHere</e226:Number>
          <e226:AccountLifeCycleStatus>ValueHere</e226:AccountLifeCycleStatus>
          <e226:PauseReason d4p1:nil="false">ValueHere</e226:PauseReason>
        </e226:AccountInfo>
      </AccountsInfo>
    </FindAccountsResponse>
  </s:Body>
</s:Envelope>

Code Syntax

The example syntax can be used with Bing Ads SDKs. See Bing Ads API Code Examples for more examples.

public async Task<FindAccountsResponse> FindAccountsAsync(
	long? customerId,
	string accountFilter,
	int topN)
{
	var request = new FindAccountsRequest
	{
		CustomerId = customerId,
		AccountFilter = accountFilter,
		TopN = topN
	};

	return (await CustomerManagementService.CallAsync((s, r) => s.FindAccountsAsync(r), request));
}
static FindAccountsResponse findAccounts(
	java.lang.Long customerId,
	java.lang.String accountFilter,
	int topN) throws RemoteException, Exception
{
	FindAccountsRequest request = new FindAccountsRequest();

	request.setCustomerId(customerId);
	request.setAccountFilter(accountFilter);
	request.setTopN(topN);

	return CustomerManagementService.getService().findAccounts(request);
}
static function FindAccounts(
	$customerId,
	$accountFilter,
	$topN)
{

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

	$request = new FindAccountsRequest();

	$request->CustomerId = $customerId;
	$request->AccountFilter = $accountFilter;
	$request->TopN = $topN;

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

Requirements

Service: CustomerManagementService.svc v13
Namespace: https://bingads.microsoft.com/Customer/v13