Muokkaa

Jaa


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.

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

CouponStartDate - The order is determined by the CouponStartDate 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:e19="https://bingads.microsoft.com/Customer/v13/Entities" i:nil="false">
        <e19:Predicate>
          <e19:Field i:nil="false">ValueHere</e19:Field>
          <e19:Operator>ValueHere</e19:Operator>
          <e19:Value i:nil="false">ValueHere</e19:Value>
        </e19:Predicate>
      </Predicates>
      <Ordering xmlns:e20="https://bingads.microsoft.com/Customer/v13/Entities" i:nil="false">
        <e20:OrderBy>
          <e20:Field>ValueHere</e20:Field>
          <e20:Order>ValueHere</e20:Order>
        </e20:OrderBy>
      </Ordering>
      <PageInfo xmlns:e21="https://bingads.microsoft.com/Customer/v13/Entities" i:nil="false">
        <e21:Index>ValueHere</e21:Index>
        <e21:Size>ValueHere</e21: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:e22="https://bingads.microsoft.com/Customer/v13/Entities" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e22:Coupon>
          <e22:CouponCode d4p1:nil="false">ValueHere</e22:CouponCode>
          <e22:CouponClassName d4p1:nil="false">ValueHere</e22:CouponClassName>
          <e22:CouponType d4p1:nil="false">ValueHere</e22:CouponType>
          <e22:Amount>ValueHere</e22:Amount>
          <e22:SpendThreshold>ValueHere</e22:SpendThreshold>
          <e22:CurrencyCode d4p1:nil="false">ValueHere</e22:CurrencyCode>
          <e22:PercentOff d4p1:nil="false">ValueHere</e22:PercentOff>
          <e22:ActiveDuration d4p1:nil="false">ValueHere</e22:ActiveDuration>
          <e22:ExpirationDate d4p1:nil="false">ValueHere</e22:ExpirationDate>
          <e22:CouponStartDate d4p1:nil="false">ValueHere</e22:CouponStartDate>
          <e22:EndDate d4p1:nil="false">ValueHere</e22:EndDate>
          <e22:SendToEmail d4p1:nil="false">ValueHere</e22:SendToEmail>
          <e22:SendToDate d4p1:nil="false">ValueHere</e22:SendToDate>
          <e22:IsRedeemed>ValueHere</e22:IsRedeemed>
          <e22:RedemptionInfo d4p1:nil="false">
            <e22:AccountId>ValueHere</e22:AccountId>
            <e22:AccountNumber d4p1:nil="false">ValueHere</e22:AccountNumber>
            <e22:SpendToThreshold>ValueHere</e22:SpendToThreshold>
            <e22:Balance>ValueHere</e22:Balance>
            <e22:CurrencyCode d4p1:nil="false">ValueHere</e22:CurrencyCode>
            <e22:RedemptionDate>ValueHere</e22:RedemptionDate>
            <e22:ExpirationDate>ValueHere</e22:ExpirationDate>
            <e22:ActivationDate d4p1:nil="false">ValueHere</e22:ActivationDate>
          </e22:RedemptionInfo>
          <e22:ClaimInfo d4p1:nil="false">
            <e22:AccountId>ValueHere</e22:AccountId>
            <e22:AccountNumber d4p1:nil="false">ValueHere</e22:AccountNumber>
            <e22:ClaimDate>ValueHere</e22:ClaimDate>
          </e22:ClaimInfo>
        </e22: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

Request Url

https://clientcenter.api.bingads.microsoft.com/CustomerBilling/v13/Coupons/Search

Request Elements

The SearchCouponsRequest object defines the body and header elements of the service operation request.

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.

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

CouponStartDate - The order is determined by the CouponStartDate 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
Authorization The OAuth access token that represents the credentials of a user who has permissions to Microsoft Advertising accounts. Please ensure that the token is prefixed with "Bearer ", this is necessary for proper authentication.

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 JSON.

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 JSON

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

{
  "Predicates": [
    {
      "Field": "ValueHere",
      "Operator": "ValueHere",
      "Value": "ValueHere"
    }
  ],
  "Ordering": [
    {
      "Field": "ValueHere",
      "Order": "ValueHere"
    }
  ],
  "PageInfo": {
    "Index": IntValueHere,
    "Size": IntValueHere
  },
  "ReturnAdditionalFields": "ValueHere"
}

Response JSON

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

{
  "Coupons": [
    {
      "ActiveDuration": IntValueHere,
      "Amount": DoubleValueHere,
      "ClaimInfo": {
        "AccountId": "LongValueHere",
        "AccountNumber": "ValueHere",
        "ClaimDate": "ValueHere"
      },
      "CouponClassName": "ValueHere",
      "CouponCode": "ValueHere",
      "CouponType": "ValueHere",
      "CurrencyCode": "ValueHere",
      "EndDate": "ValueHere",
      "ExpirationDate": "ValueHere",
      "IsRedeemed": "ValueHere",
      "PercentOff": DoubleValueHere,
      "RedemptionInfo": {
        "AccountId": "LongValueHere",
        "AccountNumber": "ValueHere",
        "ActivationDate": "ValueHere",
        "Balance": DoubleValueHere,
        "CurrencyCode": "ValueHere",
        "ExpirationDate": "ValueHere",
        "RedemptionDate": "ValueHere",
        "SpendToThreshold": DoubleValueHere
      },
      "SendToDate": "ValueHere",
      "SendToEmail": "ValueHere",
      "SpendThreshold": DoubleValueHere,
      "CouponStartDate": "ValueHere"
    }
  ]
}

Code Syntax

To call REST API through SDKs, you need to upgrade SDK to a certain version and configure the system parameters.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)