SearchCustomers Service Operation - Customer Management

Searches for customers that match a specified criteria.

Request Elements

The SearchCustomersRequest 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
DateRange Determines the minimum and maximum customer creation date range.

This request element is optional.
DateRange
IncludeCustomerAddress Determines whether or not to return the Address element in each returned Customer object.

This request element is optional. If this element is set True then the address will be returned, and otherwise it will not be included in the response (not even a nil Address element).
boolean
Ordering Determines the order of results by the specified property of a customer.

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 Id element of the returned Customer.

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

Number - The order is determined by the Number element of the returned Customer.
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 customers that match all of the specified predicates.

This request element is required. You can specify up to 10 predicates. You can use the CreatedDate predicate field twice to specify a created date range, and otherwise may only use each predicate field once.

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 SearchCustomersResponse 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
Customers A list of customers that meet the specified criteria. Customer 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">SearchCustomers</Action>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
  </s:Header>
  <s:Body>
    <SearchCustomersRequest xmlns="https://bingads.microsoft.com/Customer/v12">
      <Predicates xmlns:e274="https://bingads.microsoft.com/Customer/v12/Entities" i:nil="false">
        <e274:Predicate>
          <e274:Field i:nil="false">ValueHere</e274:Field>
          <e274:Operator>ValueHere</e274:Operator>
          <e274:Value i:nil="false">ValueHere</e274:Value>
        </e274:Predicate>
      </Predicates>
      <DateRange xmlns:e275="https://bingads.microsoft.com/Customer/v12/Entities" i:nil="false">
        <e275:MinDate i:nil="false">ValueHere</e275:MinDate>
        <e275:MaxDate i:nil="false">ValueHere</e275:MaxDate>
      </DateRange>
      <Ordering xmlns:e276="https://bingads.microsoft.com/Customer/v12/Entities" i:nil="false">
        <e276:OrderBy>
          <e276:Field>ValueHere</e276:Field>
          <e276:Order>ValueHere</e276:Order>
        </e276:OrderBy>
      </Ordering>
      <PageInfo xmlns:e277="https://bingads.microsoft.com/Customer/v12/Entities" i:nil="false">
        <e277:Index>ValueHere</e277:Index>
        <e277:Size>ValueHere</e277:Size>
      </PageInfo>
      <IncludeCustomerAddress>ValueHere</IncludeCustomerAddress>
    </SearchCustomersRequest>
  </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>
    <SearchCustomersResponse xmlns="https://bingads.microsoft.com/Customer/v12">
      <Customers xmlns:e278="https://bingads.microsoft.com/Customer/v12/Entities" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e278:Customer>
          <e278:CustomerFinancialStatus d4p1:nil="false">ValueHere</e278:CustomerFinancialStatus>
          <e278:Id d4p1:nil="false">ValueHere</e278:Id>
          <e278:Industry d4p1:nil="false">ValueHere</e278:Industry>
          <e278:LastModifiedByUserId d4p1:nil="false">ValueHere</e278:LastModifiedByUserId>
          <e278:LastModifiedTime d4p1:nil="false">ValueHere</e278:LastModifiedTime>
          <e278:MarketCountry d4p1:nil="false">ValueHere</e278:MarketCountry>
          <e278:ForwardCompatibilityMap xmlns:e279="http://schemas.datacontract.org/2004/07/System.Collections.Generic" d4p1:nil="false">
            <e279:KeyValuePairOfstringstring>
              <e279:key d4p1:nil="false">ValueHere</e279:key>
              <e279:value d4p1:nil="false">ValueHere</e279:value>
            </e279:KeyValuePairOfstringstring>
          </e278:ForwardCompatibilityMap>
          <e278:MarketLanguage d4p1:nil="false">ValueHere</e278:MarketLanguage>
          <e278:Name d4p1:nil="false">ValueHere</e278:Name>
          <e278:ServiceLevel d4p1:nil="false">ValueHere</e278:ServiceLevel>
          <e278:CustomerLifeCycleStatus d4p1:nil="false">ValueHere</e278:CustomerLifeCycleStatus>
          <e278:TimeStamp d4p1:nil="false">ValueHere</e278:TimeStamp>
          <e278:Number d4p1:nil="false">ValueHere</e278:Number>
          <e278:CustomerAddress d4p1:nil="false">
            <e278:City d4p1:nil="false">ValueHere</e278:City>
            <e278:CountryCode d4p1:nil="false">ValueHere</e278:CountryCode>
            <e278:Id d4p1:nil="false">ValueHere</e278:Id>
            <e278:Line1 d4p1:nil="false">ValueHere</e278:Line1>
            <e278:Line2 d4p1:nil="false">ValueHere</e278:Line2>
            <e278:Line3 d4p1:nil="false">ValueHere</e278:Line3>
            <e278:Line4 d4p1:nil="false">ValueHere</e278:Line4>
            <e278:PostalCode d4p1:nil="false">ValueHere</e278:PostalCode>
            <e278:StateOrProvince d4p1:nil="false">ValueHere</e278:StateOrProvince>
            <e278:TimeStamp d4p1:nil="false">ValueHere</e278:TimeStamp>
            <e278:BusinessName d4p1:nil="false">ValueHere</e278:BusinessName>
          </e278:CustomerAddress>
        </e278:Customer>
      </Customers>
    </SearchCustomersResponse>
  </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<SearchCustomersResponse> SearchCustomersAsync(
	IList<Predicate> predicates,
	DateRange dateRange,
	IList<OrderBy> ordering,
	Paging pageInfo,
	bool includeCustomerAddress)
{
	var request = new SearchCustomersRequest
	{
		Predicates = predicates,
		DateRange = dateRange,
		Ordering = ordering,
		PageInfo = pageInfo,
		IncludeCustomerAddress = includeCustomerAddress
	};

	return (await CustomerManagementService.CallAsync((s, r) => s.SearchCustomersAsync(r), request));
}
static SearchCustomersResponse searchCustomers(
	ArrayOfPredicate predicates,
	DateRange dateRange,
	ArrayOfOrderBy ordering,
	Paging pageInfo,
	boolean includeCustomerAddress) throws RemoteException, Exception
{
	SearchCustomersRequest request = new SearchCustomersRequest();

	request.setPredicates(predicates);
	request.setDateRange(dateRange);
	request.setOrdering(ordering);
	request.setPageInfo(pageInfo);
	request.setIncludeCustomerAddress(includeCustomerAddress);

	return CustomerManagementService.getService().searchCustomers(request);
}
static function SearchCustomers(
	$predicates,
	$dateRange,
	$ordering,
	$pageInfo,
	$includeCustomerAddress)
{

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

	$request = new SearchCustomersRequest();

	$request->Predicates = $predicates;
	$request->DateRange = $dateRange;
	$request->Ordering = $ordering;
	$request->PageInfo = $pageInfo;
	$request->IncludeCustomerAddress = $includeCustomerAddress;

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

Requirements

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