API: listVariants
  • 1 Minute to read
  • Dark
    Light

API: listVariants

  • Dark
    Light

Article summary

  • Starting June 1, 2022, SmarterU will require all API calls to POST to HTTPS. Any POST to HTTP will result in the SU:01 error (i.e., No POST data detected.).
  • If you are viewing the help in a language other than English, please change your language to English before copying and pasting any code. All API attributes and functions are in English.
  • Tags are required unless specified.

Description

The listVariants method returns all variants for the provided subscription.

Who Has Access

Administrators and owners have access to the listVariants method.

API Call XML Package

<SmarterU>
   <AccountAPI><![CDATA[]]></AccountAPI>
   <UserAPI><![CDATA[]]></UserAPI>
   <Method>listVariants</Method>
 
   <Parameters>
      <SubscriptionVariant>
         <SubscriptionID><![CDATA[]]></SubscriptionID>
      </SubscriptionVariant>
   </Parameters>
 
</SmarterU>

SubscriptionVariant Tag Group

The SubscriptionVariant tag group is a container for the subscriptions.

<SubscriptionVariant>
   <SubscriptionID><![CDATA[]]></SubscriptionID>
</SubscriptionVariant>

The SubscriptionVariant tag contains the following.

SubscriptionID

The subscription's system-generated identifier. This is the SubscriptionID returned by the listSubscriptions method.

API Response XML Package

The API response XML package will always include a Result, Info, and Errors tag.

<SmarterU>
   <Result></Result>
   <Info>
      <Variants>
         <Variant>
            <Name>![CDATA[]]</Name>
            <VariantID>![CDATA[]]</VariantID>
            <Duration>![CDATA[]]</Duration>
            <DurationDays>![CDATA[]]</DurationDays>
            <DurationStart>![CDATA[]]</DurationStart>
            <DurationEnd>![CDATA[]]</DurationEnd>
            <SKU>![CDATA[]]</SKU>
            <eCommerce>![CDATA[]]</eCommerce>
            <Status>![CDATA[]]</Status>
         </Variant>
      </Variants>
   </Info>

   <Errors>
      <Error>
         <ErrorID></ErrorID>
         <ErrorMessage></ErrorMessage>
      </Error>
   </Errors>

</SmarterU>

The Variants tag is a container for the variants returned by the listVariants method. Each variant is contained in a Variant tag and may contain the following.

Name

The variant's name.

VariantID

The variant's system-generated identifier. This is an internal identifier that is not accessible via the SmarterU interface. 

Duration

The variant's duration type (i.e., None (Unlimited in the SmarterU interface), Days, Date).

DurationDays

The variant's duration in days. This only returns a value when Duration is set to Days.

DurationStart

The variant's start date. This only returns a value when Duration is set to Date.

DurationEnd

The variant's end date. This only returns a value when Duration is set to Date

SKU

The variant's SKU. The tag only exists when eCommerce is enabled for the account.

eCommerce

This tag only exists when eCommerce is enabled for the account. 

Indicates whether eCommerce is enabled for the variant:

  • 0 - eCommerce is not enabled for the variant.
  • 1 - eCommerce is enabled for the variant.

Status

The variant's status (i.e., Active or Inactive).

Example API Response XML Package

Below is an example of an API response XML package.

<SmarterU>
   <Result>Success</Result>
   <Info>
      <Variants>
         <Variant>
            <Name><![CDATA[14 Days]]></Name>
            <VariantID>16</VariantID>
            <Duration>Days</Duration>
            <DurationDays>14</DurationDays>
            <DurationStart></DurationStart>
            <DurationEnd></DurationEnd>
            <SKU>ADV-4014</SKU>
            <eCommerce>0</eCommerce>
            <Status>Active</Status>        
         </Variant>

         <Variant>
            <Name><![CDATA[1 Year]]></Name>
            <VariantID>979</VariantID>
            <Duration>Days</Duration>
            <DurationDays>365</DurationDays>
            <DurationStart></DurationStart>
            <DurationEnd></DurationEnd>
            <SKU>ADV-4014</SKU>
            <eCommerce>0</eCommerce>
            <Status>Active</Status>        
         </Variant>

      </Variants>
   </Info>
   <Errors>

   </Errors>
</SmarterU>

Error Codes

Error CodeMessage
LV:02
The required permissions are not met to call the listVariants method

Was this article helpful?


What's Next