Update coupon's customer

Update Coupon Customer

This API is used to update a coupon's customer. 

 

API Details

 

Signature of API call

connection.invokeApi(String uri, String realUserName, Map<String, String> requestParameters);

See details about invoking API in general

 

Parameter 1 - URI

couponService.do

 

Parameter 2 - UserName

Username of the site admin

 

Parameter 3 - Request Parameters

Name Value
dispatch updateCustomer
xml true
id Coupon id (guid)
userId

userId (guid) of the new customer

userName

userName of the new customer

openId openId of the new customer

 

Response

Response on successfully updating the coupon

HTTP Response Code = HttpServletResponse.SC_OK

Response XML

<response code="0">
   <msgs>
      <msg>
         <code>0223</code>
         <value>
            <![CDATA[Coupon updated successfully]]>
         </value>
      </msg>
   </msgs>
</response>

Response on invalid user id / name

HTTP Response Code = HttpServletResponse.SC_NOT_FOUND

Response XML

<response code="-1">
    <msgs>
         <msg>
             <code>0004</code>
             <value><![CDATA[Unable to find User with matching id]]></value>
         </msg>
    </msgs>
</response>

Response on inactive user 

HTTP Response Code = HttpServletResponse.SC_NOT_FOUND

Response XML

<response code="-1">
    <msgs>
         <msg>
             <code>0002</code>
             <value><![CDATA[Account is inactive]]></value>
         </msg>
    </msgs>
</response>

Code Snippet

/* Check API Call for detail */

 

Map<String, String> parameters = new HashMap<String, String>();
populateMapForCouponUpdate(parameters);
String result = connection.invokeApi("couponService.do", "adminusername", parameters);
System.out.println(result);
 
private void populateMapForCouponUpdate(Map<String, String> parameters) {
    parameters.put("dispatch", "updateCoupon");
    parameters.put("xml", String.valueOf(true));
    parameters.put("id", "xxxx-xxxx-xxxx-xxxx");
    parameters.put("userName", "jdoe");
}

Rating: