SearchCoupons Service Operation - Customer Billing

Searches for coupons that match a specified criteria.

Request Elements

The SearchCouponsRequest 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 a coupon.

You should only specify 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.

ClassName - The order is determined by the ClassName element of the returned Coupon.

StartDate - The order is determined by the StartDate element of the returned Coupon.
OrderBy array
PageInfo Determines the index and size of results per page. Paging
Predicates Determines the request conditions. This operation's response will include coupons that match all of the specified predicates.

You may specify up to 4 predicates, and one of the predicate fields must be CustomerId.

For a list of supported Field and Operator elements of a Predicate object for this service operation, see Predicate Remarks.
Predicate array
ReturnAdditionalFields If set to "CouponClaimInfo", return CouponClaimInfo in the response. 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 SearchCouponsResponse 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
Coupons A list of coupons that meet the specified criteria. Coupon 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/Billing/v13">
    <Action mustUnderstand="1">SearchCoupons</Action>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
  </s:Header>
  <s:Body>
    <SearchCouponsRequest xmlns="https://bingads.microsoft.com/Billing/v13">
      <Predicates xmlns:e10="https://bingads.microsoft.com/Customer/v13/Entities" i:nil="false">
        <e10:Predicate>
          <e10:Field i:nil="false">ValueHere</e10:Field>
          <e10:Operator>ValueHere</e10:Operator>
          <e10:Value i:nil="false">ValueHere</e10:Value>
        </e10:Predicate>
      </Predicates>
      <Ordering xmlns:e11="https://bingads.microsoft.com/Customer/v13/Entities" i:nil="false">
        <e11:OrderBy>
          <e11:Field>ValueHere</e11:Field>
          <e11:Order>ValueHere</e11:Order>
        </e11:OrderBy>
      </Ordering>
      <PageInfo xmlns:e12="https://bingads.microsoft.com/Customer/v13/Entities" i:nil="false">
        <e12:Index>ValueHere</e12:Index>
        <e12:Size>ValueHere</e12:Size>
      </PageInfo>
      <ReturnAdditionalFields i:nil="false">ValueHere</ReturnAdditionalFields>
    </SearchCouponsRequest>
  </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/Billing/v13">
    <TrackingId d3p1:nil="false" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance">ValueHere</TrackingId>
  </s:Header>
  <s:Body>
    <SearchCouponsResponse xmlns="https://bingads.microsoft.com/Billing/v13">
      <Coupons xmlns:e13="https://bingads.microsoft.com/Customer/v13/Entities" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e13:Coupon>
          <e13:CouponCode d4p1:nil="false">ValueHere</e13:CouponCode>
          <e13:ClassName d4p1:nil="false">ValueHere</e13:ClassName>
          <e13:CouponType d4p1:nil="false">ValueHere</e13:CouponType>
          <e13:Amount>ValueHere</e13:Amount>
          <e13:SpendThreshold>ValueHere</e13:SpendThreshold>
          <e13:CurrencyCode d4p1:nil="false">ValueHere</e13:CurrencyCode>
          <e13:PercentOff d4p1:nil="false">ValueHere</e13:PercentOff>
          <e13:ActiveDuration d4p1:nil="false">ValueHere</e13:ActiveDuration>
          <e13:ExpirationDate d4p1:nil="false">ValueHere</e13:ExpirationDate>
          <e13:StartDate d4p1:nil="false">ValueHere</e13:StartDate>
          <e13:EndDate d4p1:nil="false">ValueHere</e13:EndDate>
          <e13:SendToEmail d4p1:nil="false">ValueHere</e13:SendToEmail>
          <e13:SendToDate d4p1:nil="false">ValueHere</e13:SendToDate>
          <e13:IsRedeemed>ValueHere</e13:IsRedeemed>
          <e13:RedemptionInfo d4p1:nil="false">
            <e13:AccountId>ValueHere</e13:AccountId>
            <e13:AccountNumber d4p1:nil="false">ValueHere</e13:AccountNumber>
            <e13:SpendToThreshold>ValueHere</e13:SpendToThreshold>
            <e13:Balance>ValueHere</e13:Balance>
            <e13:CurrencyCode d4p1:nil="false">ValueHere</e13:CurrencyCode>
            <e13:RedemptionDate>ValueHere</e13:RedemptionDate>
            <e13:ExpirationDate>ValueHere</e13:ExpirationDate>
            <e13:ActivationDate d4p1:nil="false">ValueHere</e13:ActivationDate>
          </e13:RedemptionInfo>
          <e13:ClaimInfo d4p1:nil="false">
            <e13:AccountId>ValueHere</e13:AccountId>
            <e13:AccountNumber d4p1:nil="false">ValueHere</e13:AccountNumber>
            <e13:ClaimDate>ValueHere</e13:ClaimDate>
          </e13:ClaimInfo>
        </e13:Coupon>
      </Coupons>
    </SearchCouponsResponse>
  </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<SearchCouponsResponse> SearchCouponsAsync(
	IList<Predicate> predicates,
	IList<OrderBy> ordering,
	Paging pageInfo,
	AccountAdditionalField? returnAdditionalFields)
{
	var request = new SearchCouponsRequest
	{
		Predicates = predicates,
		Ordering = ordering,
		PageInfo = pageInfo,
		ReturnAdditionalFields = returnAdditionalFields
	};

	return (await CustomerBillingService.CallAsync((s, r) => s.SearchCouponsAsync(r), request));
}
static SearchCouponsResponse searchCoupons(
	ArrayOfPredicate predicates,
	ArrayOfOrderBy ordering,
	Paging pageInfo,
	ArrayList<AccountAdditionalField> returnAdditionalFields) throws RemoteException, Exception
{
	SearchCouponsRequest request = new SearchCouponsRequest();

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

	return CustomerBillingService.getService().searchCoupons(request);
}
static function SearchCoupons(
	$predicates,
	$ordering,
	$pageInfo,
	$returnAdditionalFields)
{

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

	$request = new SearchCouponsRequest();

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

	return $GLOBALS['CustomerBillingProxy']->GetService()->SearchCoupons($request);
}
response=customerbilling_service.SearchCoupons(
	Predicates=Predicates,
	Ordering=Ordering,
	PageInfo=PageInfo,
	ReturnAdditionalFields=ReturnAdditionalFields)

Requirements

Service: CustomerBillingService.svc v13
Namespace: https://bingads.microsoft.com/Billing/v13