Creating a Catalog Item from a Template

Create a Catalog Item from a Template shows the REST binding to create a new catalog item from an offer or bundle template. You must specify the template ID and version number.

Table 1. Create a Catalog Item from a Template
URL
POST /data/CatalogItem/new/{TemplateId}/{version}
Input You must define the CatalogItemInfo. For example:
<CatalogItemInfo>
    <ExternalId>GENBASEDATA</ExternalId>
    <Name>DATA 1GB for $10</Name>
    <Description>Get 1GB of data per month</Description>
    <TemplateReference>
        <TemplateReferenceInfo>
            <Id>1</Id>
            <Version>1</Version>
            <IsBundle>false</IsBundle>
        </TemplateReferenceInfo>
    </TemplateReference>
    <ParameterBindings>
        <ParameterBindingInfo>
            <FromConstant>12</FromConstant>
            <ToParameterId>1</ToParameterId>
            <ToParameterName>MyParameter</ToParameterName>
            <ToParameterDescription>This is an example.</ToParameterDescription>
            <ToParameterType>string</ToParameterType>
            <BindTo>Constant</BindTo>
        </ParameterBindingInfo>
    </ParameterBindings>
    <StartDate>2022-01-01T00:00:00</StartDate>
    <PurchaseStartDate>2022-01-01T00:00:00</PurchaseStartDate>
    <PurchaseEndDate>2025-01-01T00:00:00</PurchaseEndDate>
    <MetadataArray>
        <MtxPricingMetadata>
            <Name>MtxDisplay</Name>
            <Type>String</Type>
        </MtxPricingMetadata>
    </MetadataArray>
    <ValueArray>
        <MtxPricingMetadata>
            <Name>DataPurchaseChargeAmount</Name>
            <Type>BigDecimal</Type>
            <Value>10.00</Value>
        </MtxPricingMetadata>
        <MtxPricingMetadata>
            <Name>DataPurchaseGrantAmount</Name>
            <Type>BigDecimal</Type>
            <Value>1</Value>
        </MtxPricingMetadata>
        <MtxPricingMetadata>
            <Name>DataRecurringChargeAmount</Name>
            <Type>BigDecimal</Type>
            <Value>10.00</Value>
        </MtxPricingMetadata>
        <MtxPricingMetadata>
            <Name>DataRecurringGrantAmount</Name>
            <Type>BigDecimal</Type>
            <Value>1</Value>
        </MtxPricingMetadata>
    </ValueArray>
</CatalogItemInfo>
Response The CreateNewCatalogItem response has the new ID (8 in the following example) and the body has all the information from the catalog item. For example:
<CreateNewCatalogItem id="8">
    <Result>0</Result>
    <ResultMessage>OK</ResultMessage>
    <OperationType>create</OperationType>
    <Id>8</Id>
    <Revision>0</Revision>
    <CorrectionNumber>** removed **</CorrectionNumber>
    <ExternalId>GENBASEDATA</ExternalId>
    <Name>DATA 1GB for $10</Name>
    <Description>Get 1GB of data per month</Description>
    <TemplateReference>
        <TemplateReferenceInfo>
            <Id>1</Id>
            <Version>1</Version>
            <IsBundle>false</IsBundle>
        </TemplateReferenceInfo>
    </TemplateReference>
    <StartDate>2022-01-01T00:00:00</StartDate>
    <PurchaseStartDate>2022-01-01T00:00:00</PurchaseStartDate>
    <PurchaseEndDate>2025-01-01T00:00:00</PurchaseEndDate>
    <ParameterBindings>
        <ParameterBindingInfo>
            <FromConstant>12</FromConstant>
            <ToParameterId>1</ToParameterId>
            <ToParameterName>MyParameter</ToParameterName>
            <ToParameterDescription>This is an example.</ToParameterDescription>
            <ToParameterType>string</ToParameterType>
            <BindTo>Constant</BindTo>
        </ParameterBindingInfo>
    </ParameterBindings>
    <MetadataArray>
        <MtxPricingMetadata>
            <Name>MtxDisplay</Name>
            <Type>String</Type>
        </MtxPricingMetadata>
    </MetadataArray>
    <ValueArray>
        <MtxPricingMetadata>
            <Name>DataRecurringGrantAmount</Name>
            <Type>BigDecimal</Type>
            <Value>1</Value>
        </MtxPricingMetadata>
        <MtxPricingMetadata>
            <Name>DataRecurringChargeAmount</Name>
            <Type>BigDecimal</Type>
            <Value>10.00</Value>
        </MtxPricingMetadata>
        <MtxPricingMetadata>
            <Name>DataPurchaseGrantAmount</Name>
            <Type>BigDecimal</Type>
            <Value>1</Value>
        </MtxPricingMetadata>
        <MtxPricingMetadata>
            <Name>DataPurchaseChargeAmount</Name>
            <Type>BigDecimal</Type>
            <Value>10.00</Value>
        </MtxPricingMetadata>
    </ValueArray>
</CreateNewCatalogItem>