Home > Cloud Cruiser 4 > REST API reference > Discounts and surcharges > Update a discount

Update a discount

Updates a discount or surcharge by its ID.

This method is available in Cloud Cruiser version 4.1 and later.

Resource URL

PUT http://<ccServerURL>/rest/v2/discounts/<Id>

Request

Parameters
  Name Type Description
URL path parameters (required) Id integer The ID of the discount or surcharge to update.
Content-Type

application/xml

Body

Updated information for the specified discount, as XML text with the root element discount or JAXB type com.cloudcruiser.server.webservices.v2.dto.discount.Discount.

Schema

This XML schema describes a discount or surcharge.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.cloudcruiser.com/webservices/v2/Common" xmlns:tns="http://www.cloudcruiser.com/webservices/v2/Discount"attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.cloudcruiser.com/webservices/v2/Discount">
  <xs:import/>
  <xs:import namespace="http://www.cloudcruiser.com/webservices/v2/Common"/>
  <xs:element name="discount" type="tns:Discount"/>
  <xs:element name="discountList">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" minOccurs="0" ref="tns:discount"/>
      </xs:sequence>
      <xs:attribute name="totalCount" type="xs:int"/>
      <xs:attribute name="retrievedCount" type="xs:int"/>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="Discount">
    <xs:sequence>
      <xs:element name="name" type="xs:string"/>
      <xs:element minOccurs="0" name="description" type="xs:string"/>
      <xs:element default="DISCOUNT" name="type" type="xs:string"/>
      <xs:element default="PERCENTAGE" name="unitsType" type="xs:string"/>
      <xs:element name="value" type="xs:double"/>
      <xs:element default="true" name="allServices" type="xs:boolean"/>
      <xs:element minOccurs="0" name="appliedServices">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="service" type="ns1:Service"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="id" type="xs:int"/>
  </xs:complexType>
</xs:schema>

Response

Content-Type

application/xml

Body

Details for the specified discount, as XML text with the root element discount or JAXB  type com.cloudcruiser.server.webservices.v2.dto.discount.Discount.

Schema

Same as for the request, above.

Example

URL invocation

PUT http://localhost:8080/rest/v2/discounts​​/10001

Java invocation
Request body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<discount xmlns="http://www.cloudcruiser.com/webservices/v2/Discount">
    <name>Extended_Discount</name>
    <description>A 7% discount for all services</description>
    <type>DISCOUNT</type>
    <unitsType>PERCENTAGE</unitsType>
    <value>7.0</value>
    <allServices>true</allServices>
</discount>
Response body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<discount xmlns="http://www.cloudcruiser.com/webservices/v2/Discount" id="10001">
    <name>Extended_Discount</name>
    <description>A 7% discount for all services</description>
    <type>DISCOUNT</type>
    <unitsType>PERCENTAGE</unitsType>
    <value>7.0</value>
    <allServices>true</allServices>
</discount>
Last modified

Tags

This page has no custom tags.

Classifications

This page has no classifications.
© Copyright 2018 Hewlett Packard Enterprise Development LP