Edit

DistributeCoupons Service Operation - Customer Billing

Distribute coupons of the specified coupon class name to the specified accounts.

Request Elements

The DistributeCouponsRequest 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
AccountIds The account IDs. int array
ClassName The class name of the distributed coupons. string
FeatureId The feature ID attached to the coupon. int
SendNotification Whether or not a notification is sent. boolean

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

Response Elements

The DistributeCouponsResponse 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
OperationErrors An array of operation errors that contains the reasons that explain why the service operation failed when the error is not related to a specific item in the batch of items. OperationError array
PartialErrors An array of OperationError objects that correspond to any email addresses where the coupon could not be distributed.

The list can be empty if there were no errors.
OperationError 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">DistributeCoupons</Action>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
  </s:Header>
  <s:Body>
    <DistributeCouponsRequest xmlns="https://bingads.microsoft.com/Billing/v13">
      <AccountIds i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <a1:int>ValueHere</a1:int>
      </AccountIds>
      <ClassName i:nil="false">ValueHere</ClassName>
      <FeatureId i:nil="false">ValueHere</FeatureId>
      <SendNotification>ValueHere</SendNotification>
    </DistributeCouponsRequest>
  </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>
    <DistributeCouponsResponse xmlns="https://bingads.microsoft.com/Billing/v13">
      <OperationErrors xmlns:e13="https://bingads.microsoft.com/Customer/v13/Exception" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e13:OperationError>
          <e13:Code>ValueHere</e13:Code>
          <e13:Details d4p1:nil="false">ValueHere</e13:Details>
          <e13:Message d4p1:nil="false">ValueHere</e13:Message>
        </e13:OperationError>
      </OperationErrors>
      <PartialErrors xmlns:e14="https://bingads.microsoft.com/Customer/v13/Exception" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e14:ArrayOfOperationError>
          <e14:OperationError>
            <e14:Code>ValueHere</e14:Code>
            <e14:Details d4p1:nil="false">ValueHere</e14:Details>
            <e14:Message d4p1:nil="false">ValueHere</e14:Message>
          </e14:OperationError>
        </e14:ArrayOfOperationError>
      </PartialErrors>
    </DistributeCouponsResponse>
  </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<DistributeCouponsResponse> DistributeCouponsAsync(
	IList<int> accountIds,
	string className,
	int? featureId,
	bool sendNotification)
{
	var request = new DistributeCouponsRequest
	{
		AccountIds = accountIds,
		ClassName = className,
		FeatureId = featureId,
		SendNotification = sendNotification
	};

	return (await CustomerBillingService.CallAsync((s, r) => s.DistributeCouponsAsync(r), request));
}
static DistributeCouponsResponse distributeCoupons(
	ArrayOfint accountIds,
	java.lang.String className,
	int featureId,
	boolean sendNotification) throws RemoteException, Exception
{
	DistributeCouponsRequest request = new DistributeCouponsRequest();

	request.setAccountIds(accountIds);
	request.setClassName(className);
	request.setFeatureId(featureId);
	request.setSendNotification(sendNotification);

	return CustomerBillingService.getService().distributeCoupons(request);
}
static function DistributeCoupons(
	$accountIds,
	$className,
	$featureId,
	$sendNotification)
{

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

	$request = new DistributeCouponsRequest();

	$request->AccountIds = $accountIds;
	$request->ClassName = $className;
	$request->FeatureId = $featureId;
	$request->SendNotification = $sendNotification;

	return $GLOBALS['CustomerBillingProxy']->GetService()->DistributeCoupons($request);
}
response=customerbilling_service.DistributeCoupons(
	AccountIds=AccountIds,
	ClassName=ClassName,
	FeatureId=FeatureId,
	SendNotification=SendNotification)

Requirements

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

Request Url

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

Request Elements

The DistributeCouponsRequest 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
AccountIds The account IDs. int array
ClassName The class name of the distributed coupons. string
FeatureId The feature ID attached to the coupon. int
SendNotification Whether or not a notification is sent. boolean

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

Response Elements

The DistributeCouponsResponse 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
OperationErrors An array of operation errors that contains the reasons that explain why the service operation failed when the error is not related to a specific item in the batch of items. OperationError array
PartialErrors An array of OperationError objects that correspond to any email addresses where the coupon could not be distributed.

The list can be empty if there were no errors.
OperationError 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.

{
  "AccountIds": [
    IntValueHere
  ],
  "ClassName": "ValueHere",
  "FeatureId": IntValueHere,
  "SendNotification": "ValueHere"
}

Response JSON

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

{
  "OperationErrors": [
    {
      "Code": IntValueHere,
      "Details": "ValueHere",
      "Message": "ValueHere"
    }
  ],
  "PartialErrors": [
    {
      "Code": IntValueHere,
      "Details": "ValueHere",
      "Message": "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<DistributeCouponsResponse> DistributeCouponsAsync(
	IList<int> accountIds,
	string className,
	int? featureId,
	bool sendNotification)
{
	var request = new DistributeCouponsRequest
	{
		AccountIds = accountIds,
		ClassName = className,
		FeatureId = featureId,
		SendNotification = sendNotification
	};

	return (await CustomerBillingService.CallAsync((s, r) => s.DistributeCouponsAsync(r), request));
}
static DistributeCouponsResponse distributeCoupons(
	ArrayOfint accountIds,
	java.lang.String className,
	int featureId,
	boolean sendNotification) throws RemoteException, Exception
{
	DistributeCouponsRequest request = new DistributeCouponsRequest();

	request.setAccountIds(accountIds);
	request.setClassName(className);
	request.setFeatureId(featureId);
	request.setSendNotification(sendNotification);

	return CustomerBillingService.getService().distributeCoupons(request);
}
static function DistributeCoupons(
	$accountIds,
	$className,
	$featureId,
	$sendNotification)
{

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

	$request = new DistributeCouponsRequest();

	$request->AccountIds = $accountIds;
	$request->ClassName = $className;
	$request->FeatureId = $featureId;
	$request->SendNotification = $sendNotification;

	return $GLOBALS['CustomerBillingProxy']->GetService()->DistributeCoupons($request);
}
response=customerbilling_service.DistributeCoupons(
	AccountIds=AccountIds,
	ClassName=ClassName,
	FeatureId=FeatureId,
	SendNotification=SendNotification)