Home > Cloud Cruiser 4 > REST API reference > Rate plans > Import rate plans

Import rate plans

Imports CSV-formatted rates.

Resource URL

In version 4.0: POST http://<ccServerURL>/rest/v2/services/rates/import

In version 4.1 and later: POST http://<ccServerURL>/rest/v2/ratePlans/import

Request

Parameters
  Name Type Description
Request header parameters (optional) defaultStartDate string The start date to apply when an imported rate is missing an effective_date and no current effective date range exists for the rate plan. The format is yyyyMMdd, and the default is 20000101.
updateDuplicates boolean Whether to update an existing rate when the source data contains a duplicate. When false, the duplicate source row is ignored. The default is false.
Content-Type

text/csv

Body

The rates to import, in Rate Plan CSV file format.

Response

Content-Type

application/xml

Body

Details for the result of the import, as XML text with the root element itemImportResult or JAXB type com.cloudcruiser.server.webservices.v2.dto.common.ItemImportResult.

Schema

Version 4.0
Version 4.1 and later

For Cloud Cruiser 4.1 and later, this XML schema describes rate plans and their contained effective date ranges.

<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/Rateplan" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.cloudcruiser.com/webservices/v2/Rateplan">
  <xs:import namespace="http://www.cloudcruiser.com/webservices/v2/Common"/>
  <xs:import/>
  <xs:element name="ratePlan" type="tns:RatePlan"/>
  <xs:element name="ratePlanList" type="tns:RatePlanList"/>
  <xs:element name="ratePlanSummaryList" type="tns:RatePlanSummaryList"/>
  <xs:element name="revision" type="tns:Revision"/>
  <xs:element name="revisions" type="tns:Revisions"/>
  <xs:element name="serviceRate" type="tns:ServiceRate"/>
  <xs:complexType name="RatePlan">
    <xs:sequence>
      <xs:element name="planName" type="xs:string"/>
      <xs:element minOccurs="0" name="description" type="xs:string"/>
      <xs:element default="false" name="defaultPlan" type="xs:boolean"/>
      <xs:element default="false" name="costPlan" type="xs:boolean"/>
      <xs:element default="true" name="valid" type="xs:boolean"/>
      <xs:element maxOccurs="unbounded" ref="tns:revision"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="associatedCustomer" type="tns:AssociatedCustomer"/>
    </xs:sequence>
    <xs:attribute name="id" type="xs:int"/>
  </xs:complexType>
  <xs:complexType name="Revision">
    <xs:sequence>
      <xs:element minOccurs="0" name="ratePlan">
        <xs:complexType>
          <xs:sequence/>
          <xs:attribute name="name" type="xs:string"/>
          <xs:attribute name="id" type="xs:int"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="startDate" type="ns1:StartOfDay"/>
      <xs:element name="endDate" type="ns1:EndOfDay"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" ref="tns:serviceRate"/>
    </xs:sequence>
    <xs:attribute name="id" type="xs:int"/>
  </xs:complexType>
  <xs:complexType name="ServiceRate">
    <xs:sequence>
      <xs:element name="service" type="ns1:Service"/>
      <xs:element minOccurs="0" name="serviceRateDesc" type="xs:string"/>
      <xs:element default="4" name="priceDecimals" type="xs:short"/>
      <xs:element minOccurs="0" name="minimumCommit">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="value" type="xs:double"/>
            <xs:element name="interval" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element minOccurs="0" name="targetAccountField" type="xs:string"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="tag">
        <xs:complexType>
          <xs:sequence/>
          <xs:attribute name="name" type="xs:string" use="required"/>
          <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
      </xs:element>
      <xs:element maxOccurs="unbounded" name="rateItem" type="tns:RateItem"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType abstract="true" name="RateItem">
    <xs:sequence>
      <xs:element minOccurs="0" name="rate" type="xs:double"/>
      <xs:element minOccurs="0" name="fixedCharge" type="xs:double"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="PassthroughRateItem">
    <xs:complexContent>
      <xs:extension base="tns:RateItem">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="BasicRateItem">
    <xs:complexContent>
      <xs:extension base="tns:RateItem">
        <xs:sequence>
          <xs:element minOccurs="0" name="minUnits" type="xs:double"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType abstract="true" name="TierRateItem">
    <xs:complexContent>
      <xs:extension base="tns:RateItem">
        <xs:sequence>
          <xs:element name="tierName" type="xs:string"/>
          <xs:element name="lowRange" type="xs:double"/>
          <xs:element minOccurs="0" name="highRange" type="xs:double"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="PerTierRateItem">
    <xs:complexContent>
      <xs:extension base="tns:TierRateItem">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="HighTierMeteredRateItem">
    <xs:complexContent>
      <xs:extension base="tns:TierRateItem">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="HighTierAllocatedRateItem">
    <xs:complexContent>
      <xs:extension base="tns:TierRateItem">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="PerTierAllocatedRateItem">
    <xs:complexContent>
      <xs:extension base="tns:TierRateItem">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="HighTierRateItem">
    <xs:complexContent>
      <xs:extension base="tns:TierRateItem">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="PerTierMeteredRateItem">
    <xs:complexContent>
      <xs:extension base="tns:TierRateItem">
        <xs:sequence/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="AssociatedCustomer">
    <xs:sequence/>
    <xs:attribute name="id" type="xs:int"/>
    <xs:attribute name="customerid" type="xs:string"/>
  </xs:complexType>
  <xs:complexType name="RatePlanSummaryList">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="ratePlanSummary" type="tns:RatePlanSummary"/>
    </xs:sequence>
    <xs:attribute name="totalPlans" type="xs:int"/>
    <xs:attribute name="retrievedPlans" type="xs:int"/>
    <xs:attribute name="startFrom" type="xs:int"/>
  </xs:complexType>
  <xs:complexType name="RatePlanSummary">
    <xs:sequence>
      <xs:element name="planName" type="xs:string"/>
      <xs:element minOccurs="0" name="description" type="xs:string"/>
      <xs:element maxOccurs="unbounded" name="revisionSummary">
        <xs:complexType>
          <xs:sequence/>
          <xs:attribute name="id" type="xs:int" use="required"/>
          <xs:attribute name="startDate" type="xs:string" use="required"/>
          <xs:attribute name="endDate" type="xs:string" use="required"/>
          <xs:attribute name="serviceCount" type="xs:int"/>
        </xs:complexType>
      </xs:element>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="associatedCustomer" type="tns:AssociatedCustomer"/>
    </xs:sequence>
    <xs:attribute name="id" type="xs:int" use="required"/>
    <xs:attribute name="defaultPlan" type="xs:boolean"/>
    <xs:attribute name="costPlan" type="xs:boolean"/>
    <xs:attribute name="valid" type="xs:boolean"/>
  </xs:complexType>
  <xs:complexType name="Revisions">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" ref="tns:revision"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="RatePlanList">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" ref="tns:ratePlan"/>
    </xs:sequence>
    <xs:attribute name="totalPlans" type="xs:int"/>
    <xs:attribute name="retrievedPlans" type="xs:int"/>
  </xs:complexType>
</xs:schema>

Example

URL invocation

POST http://localhost:8080/rest/v2/ratePlans/import

Request header parameters

Content-Type: text/csv

updateDuplicates: true

Java invocation
Request body
rate_plan_name,rate_plan_desc,service_name,effective_date,rate_type,rate_decimals,minimum_units,state_name,state_desc,tier_name,tier_low_range,tier_target_account_field,fixed_charge_amount,rate
Start-ups,Rate plan for start-ups,test-svc-2,20110101,basic,4,,,,,,,,0
test-plan-1,test plan 1,test-svc-2,20000101,hightier,4,,,,t-2,200,,,10
test-plan-1,test plan 1,test-svc-2,20000101,hightier,4,,,,t-1,0,,,11
test-plan-1,test plan 1,test-svc-1,20000101,pertier,4,,,,t1,0,,,20
test-plan-1,test plan 1,test-svc-1,20000101,pertier,4,,,,t2,100,,,18
test-plan-1,test plan 1,Network Traffic In,20000101,basic,4,,,,,,,,0.55
test-plan-1,test plan 1,Small VM,20000101,basic,4,,,,,,,2,80
test-plan-1,test plan 1,test-svc-2,20140901,hightier,4,,,,t-1,0,,,11
test-plan-1,test plan 1,test-svc-2,20140901,hightier,4,,,,t-2,200,,,10
test-plan-1,test plan 1,test-svc-1,20140901,basic,4,,,,,,,,57
test-plan-1,test plan 1,Network Traffic In,20140901,basic,4,,,,,,,,0.55
test-plan-1,test plan 1,Small VM,20140901,basic,4,,,,,,,2,80
Response body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<itemImportResult xmlns="http://www.cloudcruiser.com/webservices/v2/Common">
  <importedSummary>
    <totalItems>12</totalItems>
    <newItems>0</newItems>
    <duplicateItems>0</duplicateItems>
    <updatedItems>12</updatedItems>
  </importedSummary>
  <updatedItemNames>
    <updatedItemName>(rate plan: Start-ups, service: test-svc-2)</updatedItemName>
    <updatedItemName>(rate plan: test-plan-1, service: test-svc-2)</updatedItemName>
    <updatedItemName>(rate plan: test-plan-1, service: test-svc-2)</updatedItemName>
    <updatedItemName>(rate plan: test-plan-1, service: test-svc-1)</updatedItemName>
    <updatedItemName>(rate plan: test-plan-1, service: test-svc-1)</updatedItemName>
    <updatedItemName>(rate plan: test-plan-1, service: Network Traffic In)</updatedItemName>
    <updatedItemName>(rate plan: test-plan-1, service: Small VM)</updatedItemName>
    <updatedItemName>(rate plan: test-plan-1, service: test-svc-2)</updatedItemName>
    <updatedItemName>(rate plan: test-plan-1, service: test-svc-2)</updatedItemName>
    <updatedItemName>(rate plan: test-plan-1, service: test-svc-1)</updatedItemName>
    <updatedItemName>(rate plan: test-plan-1, service: Network Traffic In)</updatedItemName>
    <updatedItemName>(rate plan: test-plan-1, service: Small VM)</updatedItemName>
  </updatedItemNames>
</itemImportResult>
Last modified

Tags

Classifications

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