Edit

Kongsi melalui


SearchAccounts Service Operation - Customer Management

Searches for accounts that match the request criteria.

For example you can search for accounts that the current authenticated user can access.

Tip

Please see the Account Hierchy and User Permissions guide for an overview with examples.

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.

Note

Unless otherwise noted below, all request elements are required.

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.

If you set the Field element of the OrderBy object to "Id", "Name", or "Number", the returned Accounts will be ordered by the account identifiers, names, or numbers accordingly.

This request element is optional.
OrderBy array
PageInfo Determines the index and size of results per page. Paging
Predicates Determines the conditions that all must be met to return accounts.

You must include exactly one predicate. If the predicate Field is set to "AccountLifeCycleStatus", then you must specify one additional predicate with the Field set to another value such as UserId.

For details about each supported predicate Field value see Predicate Remarks.
Predicate array
ReturnAdditionalFields The list of additional properties that you want included within each returned account. The additional field values enable you to get the latest features using the current version of Customer Management API, and in the next version the corresponding elements will be included by default.

This request element is optional.
AccountAdditionalField

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 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 request 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/v13">
    <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/v13">
      <Predicates xmlns:e243="https://bingads.microsoft.com/Customer/v13/Entities" i:nil="false">
        <e243:Predicate>
          <e243:Field i:nil="false">ValueHere</e243:Field>
          <e243:Operator>ValueHere</e243:Operator>
          <e243:Value i:nil="false">ValueHere</e243:Value>
        </e243:Predicate>
      </Predicates>
      <Ordering xmlns:e244="https://bingads.microsoft.com/Customer/v13/Entities" i:nil="false">
        <e244:OrderBy>
          <e244:Field>ValueHere</e244:Field>
          <e244:Order>ValueHere</e244:Order>
        </e244:OrderBy>
      </Ordering>
      <PageInfo xmlns:e245="https://bingads.microsoft.com/Customer/v13/Entities" i:nil="false">
        <e245:Index>ValueHere</e245:Index>
        <e245:Size>ValueHere</e245:Size>
      </PageInfo>
      <ReturnAdditionalFields i:nil="false">ValueHere</ReturnAdditionalFields>
    </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/v13">
    <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/v13">
      <Accounts xmlns:e246="https://bingads.microsoft.com/Customer/v13/Entities" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e246:AdvertiserAccount>
          <e246:BillToCustomerId d4p1:nil="false">ValueHere</e246:BillToCustomerId>
          <e246:CurrencyCode d4p1:nil="false">ValueHere</e246:CurrencyCode>
          <e246:AccountFinancialStatus d4p1:nil="false">ValueHere</e246:AccountFinancialStatus>
          <e246:Id d4p1:nil="false">ValueHere</e246:Id>
          <e246:Language d4p1:nil="false">ValueHere</e246:Language>
          <e246:LastModifiedByUserId d4p1:nil="false">ValueHere</e246:LastModifiedByUserId>
          <e246:LastModifiedTime d4p1:nil="false">ValueHere</e246:LastModifiedTime>
          <e246:Name d4p1:nil="false">ValueHere</e246:Name>
          <e246:Number d4p1:nil="false">ValueHere</e246:Number>
          <e246:ParentCustomerId>ValueHere</e246:ParentCustomerId>
          <e246:PaymentMethodId d4p1:nil="false">ValueHere</e246:PaymentMethodId>
          <e246:PaymentMethodType d4p1:nil="false">ValueHere</e246:PaymentMethodType>
          <e246:PrimaryUserId d4p1:nil="false">ValueHere</e246:PrimaryUserId>
          <e246:AccountLifeCycleStatus d4p1:nil="false">ValueHere</e246:AccountLifeCycleStatus>
          <e246:TimeStamp d4p1:nil="false">ValueHere</e246:TimeStamp>
          <e246:TimeZone d4p1:nil="false">ValueHere</e246:TimeZone>
          <e246:PauseReason d4p1:nil="false">ValueHere</e246:PauseReason>
          <e246:ForwardCompatibilityMap xmlns:e247="http://schemas.datacontract.org/2004/07/System.Collections.Generic" d4p1:nil="false">
            <e247:KeyValuePairOfstringstring>
              <e247:key d4p1:nil="false">ValueHere</e247:key>
              <e247:value d4p1:nil="false">ValueHere</e247:value>
            </e247:KeyValuePairOfstringstring>
          </e246:ForwardCompatibilityMap>
          <e246:LinkedAgencies d4p1:nil="false">
            <e246:CustomerInfo>
              <e246:Id d4p1:nil="false">ValueHere</e246:Id>
              <e246:Name d4p1:nil="false">ValueHere</e246:Name>
            </e246:CustomerInfo>
          </e246:LinkedAgencies>
          <e246:SalesHouseCustomerId d4p1:nil="false">ValueHere</e246:SalesHouseCustomerId>
          <e246:TaxInformation xmlns:e248="http://schemas.datacontract.org/2004/07/System.Collections.Generic" d4p1:nil="false">
            <e248:KeyValuePairOfstringstring>
              <e248:key d4p1:nil="false">ValueHere</e248:key>
              <e248:value d4p1:nil="false">ValueHere</e248:value>
            </e248:KeyValuePairOfstringstring>
          </e246:TaxInformation>
          <e246:BackUpPaymentInstrumentId d4p1:nil="false">ValueHere</e246:BackUpPaymentInstrumentId>
          <e246:BillingThresholdAmount d4p1:nil="false">ValueHere</e246:BillingThresholdAmount>
          <e246:BusinessAddress d4p1:nil="false">
            <e246:City d4p1:nil="false">ValueHere</e246:City>
            <e246:CountryCode d4p1:nil="false">ValueHere</e246:CountryCode>
            <e246:Id d4p1:nil="false">ValueHere</e246:Id>
            <e246:Line1 d4p1:nil="false">ValueHere</e246:Line1>
            <e246:Line2 d4p1:nil="false">ValueHere</e246:Line2>
            <e246:Line3 d4p1:nil="false">ValueHere</e246:Line3>
            <e246:Line4 d4p1:nil="false">ValueHere</e246:Line4>
            <e246:PostalCode d4p1:nil="false">ValueHere</e246:PostalCode>
            <e246:StateOrProvince d4p1:nil="false">ValueHere</e246:StateOrProvince>
            <e246:TimeStamp d4p1:nil="false">ValueHere</e246:TimeStamp>
            <e246:BusinessName d4p1:nil="false">ValueHere</e246:BusinessName>
          </e246:BusinessAddress>
          <e246:AutoTagType d4p1:nil="false">ValueHere</e246:AutoTagType>
          <e246:SoldToPaymentInstrumentId d4p1:nil="false">ValueHere</e246:SoldToPaymentInstrumentId>
          <e246:TaxCertificate d4p1:nil="false">
            <e246:TaxCertificateBlobContainerName d4p1:nil="false">ValueHere</e246:TaxCertificateBlobContainerName>
            <e246:TaxCertificates xmlns:e249="http://schemas.datacontract.org/2004/07/System.Collections.Generic" d4p1:nil="false">
              <e249:KeyValuePairOfstringbase64Binary>
                <e249:key d4p1:nil="false">ValueHere</e249:key>
                <e249:value d4p1:nil="false">ValueHere</e249:value>
              </e249:KeyValuePairOfstringbase64Binary>
            </e246:TaxCertificates>
            <e246:Status d4p1:nil="false">ValueHere</e246:Status>
          </e246:TaxCertificate>
          <e246:AccountMode d4p1:nil="false">ValueHere</e246:AccountMode>
        </e246:AdvertiserAccount>
      </Accounts>
    </SearchAccountsResponse>
  </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<SearchAccountsResponse> SearchAccountsAsync(
	IList<Predicate> predicates,
	IList<OrderBy> ordering,
	Paging pageInfo,
	AccountAdditionalField? returnAdditionalFields)
{
	var request = new SearchAccountsRequest
	{
		Predicates = predicates,
		Ordering = ordering,
		PageInfo = pageInfo,
		ReturnAdditionalFields = returnAdditionalFields
	};

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

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

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

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

	$request = new SearchAccountsRequest();

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

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

Requirements

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