Coupon Code

Promotions allow you to track the source of revenue and to offer discounts in the form of coupons. Each promotion has a promotion code that can be applied to transactions and campaigns.

The coupon code record is defined in the listMkt (marketing) XSD.

For information about working with coupon codes in the UI, see Coupon Codes.

Supported Operations

The following operations can be used with coupon code records:

add | addList | delete | deleteList | get | getDeleted | getList | search | searchMoreWithId | update | updateList | upsert | upsertList

Note:

You can also use the asynchronous equivalents of SOAP web services list operations. For information about asynchronous operations, see SOAP Web Services Asynchronous Operations. For more information about request processing, see Synchronous Versus Asynchronous Request Processing.

Field Definitions

The SOAP Schema Browser includes definitions for all body fields, sublist fields, search filters, and search joins available to this record. For details, see the SOAP Schema Browser’s coupon code reference page.

Note:

For information about using the SOAP Schema Browser, see SOAP Schema Browser.

Code Sample

The following sample shows how to add a coupon code through SOAP web services. Note that to work with coupon codes, you must have a promotion with “single use” coupon codes (Promotion record > Codes subtab > Number of Uses > Single Use). Then you can start adding coupon codes.

Java

          public void addCouponCode() throws Exception
   {
      this.login();
 
      CouponCode cc = new CouponCode();
      RecordRef promoRef = new RecordRef();
      promoRef.setInternalId("3");
      cc.setPromotion(promoRef);    // the promotion the coupon code is bound to
 
      cc.setExternalId("exCC12345");
      cc.setCode("CouponCode2012");
 
      RecordRef recRef = new RecordRef();
      recRef.setInternalId("15");
      cc.setRecipient(recRef);
      cc.setDateSent(Calendar.getInstance());
      _port.add(cc);
   } 

        

SOAP Request

          <soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header>
        <ns1:passport soapenv:mustUnderstand="0" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" xmlns:ns1="urn:messages_2017_1.platform.webservices.netsuite.com">
            <ns2:email xmlns:ns2="urn:core_2017_1.platform.webservices.netsuite.com">email@netsuite.com</ns2:email>
            <ns3:password xmlns:ns3="urn:core_2017_1.platform.webservices.netsuite.com">*******</ns3:password>
            <ns4:account xmlns:ns4="urn:core_2017_1.platform.webservices.netsuite.com">1234567</ns4:account>
            <ns5:role internalId="37" xmlns:ns5="urn:core_2017_1.platform.webservices.netsuite.com"/>
        </ns1:passport>
    </soapenv:Header>
    <soapenv:Body>
        <add xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
            <record xsi:type="ns6:CouponCode" externalId="exCC12345" xmlns:ns6="urn:marketing_2017_1.lists.webservices.netsuite.com">
                <ns6:promotion xsi:type="ns7:RecordRef" internalId="3" xmlns:ns7="urn:core_2017_1.platform.webservices.netsuite.com"/>
                <ns6:code xsi:type="xsd:string">CouponCode2012</ns6:code>
                <ns6:recipient xsi:type="ns8:RecordRef" internalId="15" xmlns:ns8="urn:core_2017_1.platform.webservices.netsuite.com"/>
                <ns6:dateSent xsi:type="xsd:dateTime">2012-08-10T08:13:27.370Z</ns6:dateSent>
            </record>
        </add>
    </soapenv:Body>
</soapenv:Envelope> 

        

SOAP Response

          <soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header>
        <platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2017_1.platform.webservices.netsuite.com">
            <platformMsgs:nsId>WEBSERVICES_1326288_08102012261640432423581449_323eee69f5203</platformMsgs:nsId>
        </platformMsgs:documentInfo>
    </soapenv:Header>
    <soapenv:Body>
        <addResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
            <writeResponse>
                <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
                <baseRef xsi:type="platformCore:RecordRef" type="couponCode" externalId="exCC12345" internalId="3" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
            </writeResponse>
        </addResponse>
    </soapenv:Body>
</soapenv:Envelope> 

        

Related Topics

General Notices