SearchAccounts Service Operation - Customer Management

Searches for accounts that match a specified criteria.

Request Elements

The SearchAccountsRequest 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.

Request Body Elements

Element Description Data Type
Ordering Determines the order of results by the specified property of an account.

This request element is optional. You can specify up to one OrderBy element in the array. Additional elements are not supported and will be ignored by the service.

For this service operation, the following values are supported in the Field element of a OrderBy object.

Id - The order is determined by the Idelement of the returned AdvertiserAccount.

Name - The order is determined by the Name element of the returned AdvertiserAccount.

Number - The order is determined by the Number element of the returned AdvertiserAccount.
OrderBy array
PageInfo Determines the index and size of results per page.

This request element is required.
Paging
Predicates Determines the request conditions. This operation's response will include accounts that match all of the specified predicates.

This request element is required. With the exception of AccountLifeCycleStatus, you must specify exactly one predicate. When using the AccountLifeCycleStatus predicate field you must specify one additional predicate, for example with the Field set to UserId.

For a list of supported Field and Operator elements of a Predicate object for this service operation, see Predicate Remarks.
Predicate array

Request Header Elements

Element Description Data Type
AuthenticationToken The OAuth access token that represents a Microsoft Account user who has permissions to Bing Ads accounts. string
DeveloperToken The developer token used to access the Bing Ads API. 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 SearchAccountsResponse 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
Accounts A list of accounts that meet the specified criteria. AdvertiserAccount 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/v12">
    <Action mustUnderstand="1">SearchAccounts</Action>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
  </s:Header>
  <s:Body>
    <SearchAccountsRequest xmlns="https://bingads.microsoft.com/Customer/v12">
      <Predicates xmlns:e263="https://bingads.microsoft.com/Customer/v12/Entities" i:nil="false">
        <e263:Predicate>
          <e263:Field i:nil="false">ValueHere</e263:Field>
          <e263:Operator>ValueHere</e263:Operator>
          <e263:Value i:nil="false">ValueHere</e263:Value>
        </e263:Predicate>
      </Predicates>
      <Ordering xmlns:e264="https://bingads.microsoft.com/Customer/v12/Entities" i:nil="false">
        <e264:OrderBy>
          <e264:Field>ValueHere</e264:Field>
          <e264:Order>ValueHere</e264:Order>
        </e264:OrderBy>
      </Ordering>
      <PageInfo xmlns:e265="https://bingads.microsoft.com/Customer/v12/Entities" i:nil="false">
        <e265:Index>ValueHere</e265:Index>
        <e265:Size>ValueHere</e265:Size>
      </PageInfo>
    </SearchAccountsRequest>
  </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/v12">
    <TrackingId d3p1:nil="false" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance">ValueHere</TrackingId>
  </s:Header>
  <s:Body>
    <SearchAccountsResponse xmlns="https://bingads.microsoft.com/Customer/v12">
      <Accounts xmlns:e266="https://bingads.microsoft.com/Customer/v12/Entities" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e266:AdvertiserAccount>
          <e266:BillToCustomerId d4p1:nil="false">ValueHere</e266:BillToCustomerId>
          <e266:CurrencyCode d4p1:nil="false">ValueHere</e266:CurrencyCode>
          <e266:AccountFinancialStatus d4p1:nil="false">ValueHere</e266:AccountFinancialStatus>
          <e266:Id d4p1:nil="false">ValueHere</e266:Id>
          <e266:Language d4p1:nil="false">ValueHere</e266:Language>
          <e266:LastModifiedByUserId d4p1:nil="false">ValueHere</e266:LastModifiedByUserId>
          <e266:LastModifiedTime d4p1:nil="false">ValueHere</e266:LastModifiedTime>
          <e266:Name d4p1:nil="false">ValueHere</e266:Name>
          <e266:Number d4p1:nil="false">ValueHere</e266:Number>
          <e266:ParentCustomerId>ValueHere</e266:ParentCustomerId>
          <e266:PaymentMethodId d4p1:nil="false">ValueHere</e266:PaymentMethodId>
          <e266:PaymentMethodType d4p1:nil="false">ValueHere</e266:PaymentMethodType>
          <e266:PrimaryUserId d4p1:nil="false">ValueHere</e266:PrimaryUserId>
          <e266:AccountLifeCycleStatus d4p1:nil="false">ValueHere</e266:AccountLifeCycleStatus>
          <e266:TimeStamp d4p1:nil="false">ValueHere</e266:TimeStamp>
          <e266:TimeZone d4p1:nil="false">ValueHere</e266:TimeZone>
          <e266:PauseReason d4p1:nil="false">ValueHere</e266:PauseReason>
          <e266:ForwardCompatibilityMap xmlns:e267="http://schemas.datacontract.org/2004/07/System.Collections.Generic" d4p1:nil="false">
            <e267:KeyValuePairOfstringstring>
              <e267:key d4p1:nil="false">ValueHere</e267:key>
              <e267:value d4p1:nil="false">ValueHere</e267:value>
            </e267:KeyValuePairOfstringstring>
          </e266:ForwardCompatibilityMap>
          <e266:LinkedAgencies d4p1:nil="false">
            <e266:CustomerInfo>
              <e266:Id d4p1:nil="false">ValueHere</e266:Id>
              <e266:Name d4p1:nil="false">ValueHere</e266:Name>
            </e266:CustomerInfo>
          </e266:LinkedAgencies>
          <e266:SalesHouseCustomerId d4p1:nil="false">ValueHere</e266:SalesHouseCustomerId>
          <e266:TaxInformation xmlns:e268="http://schemas.datacontract.org/2004/07/System.Collections.Generic" d4p1:nil="false">
            <e268:KeyValuePairOfstringstring>
              <e268:key d4p1:nil="false">ValueHere</e268:key>
              <e268:value d4p1:nil="false">ValueHere</e268:value>
            </e268:KeyValuePairOfstringstring>
          </e266:TaxInformation>
          <e266:BackUpPaymentInstrumentId d4p1:nil="false">ValueHere</e266:BackUpPaymentInstrumentId>
          <e266:BillingThresholdAmount d4p1:nil="false">ValueHere</e266:BillingThresholdAmount>
          <e266:BusinessAddress d4p1:nil="false">
            <e266:City d4p1:nil="false">ValueHere</e266:City>
            <e266:CountryCode d4p1:nil="false">ValueHere</e266:CountryCode>
            <e266:Id d4p1:nil="false">ValueHere</e266:Id>
            <e266:Line1 d4p1:nil="false">ValueHere</e266:Line1>
            <e266:Line2 d4p1:nil="false">ValueHere</e266:Line2>
            <e266:Line3 d4p1:nil="false">ValueHere</e266:Line3>
            <e266:Line4 d4p1:nil="false">ValueHere</e266:Line4>
            <e266:PostalCode d4p1:nil="false">ValueHere</e266:PostalCode>
            <e266:StateOrProvince d4p1:nil="false">ValueHere</e266:StateOrProvince>
            <e266:TimeStamp d4p1:nil="false">ValueHere</e266:TimeStamp>
            <e266:BusinessName d4p1:nil="false">ValueHere</e266:BusinessName>
          </e266:BusinessAddress>
          <e266:AutoTagType d4p1:nil="false">ValueHere</e266:AutoTagType>
          <e266:SoldToPaymentInstrumentId d4p1:nil="false">ValueHere</e266:SoldToPaymentInstrumentId>
        </e266:AdvertiserAccount>
      </Accounts>
    </SearchAccountsResponse>
  </s:Body>
</s:Envelope>

Code Syntax

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

public async Task<SearchAccountsResponse> SearchAccountsAsync(
	IList<Predicate> predicates,
	IList<OrderBy> ordering,
	Paging pageInfo)
{
	var request = new SearchAccountsRequest
	{
		Predicates = predicates,
		Ordering = ordering,
		PageInfo = pageInfo
	};

	return (await CustomerManagementService.CallAsync((s, r) => s.SearchAccountsAsync(r), request));
}
static SearchAccountsResponse searchAccounts(
	ArrayOfPredicate predicates,
	ArrayOfOrderBy ordering,
	Paging pageInfo) throws RemoteException, Exception
{
	SearchAccountsRequest request = new SearchAccountsRequest();

	request.setPredicates(predicates);
	request.setOrdering(ordering);
	request.setPageInfo(pageInfo);

	return CustomerManagementService.getService().searchAccounts(request);
}
static function SearchAccounts(
	$predicates,
	$ordering,
	$pageInfo)
{

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

	$request = new SearchAccountsRequest();

	$request->Predicates = $predicates;
	$request->Ordering = $ordering;
	$request->PageInfo = $pageInfo;

	return $GLOBALS['CustomerManagementProxy']->GetService()->SearchAccounts($request);
}
response=customermanagement_service.SearchAccounts(
	Predicates=Predicates,
	Ordering=Ordering,
	PageInfo=PageInfo)

Requirements

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