Create subscription

Creates a new Subscription. The Subscription will be inactive. To activate a Subscription the Checkout process must be used. See PurchaseSubscription.

Request
query Parameters
ipAddress
required
string

The ip-address of the end user.

createdBy
required
integer <int32>

Account internal id of current user.

pricelistSeed
string

A comma separated list of internal pricelist ids to use, if any. PriceLists supplied must be valid, either from the application's public priceList or any customer or company priceLists or any valid client priceLists. For clients configured to use priceListSeed exclusively in the API only the supplied priceLists will be used. If this is not configured, the supplied priceLists will be appended to the valid priceLists. If none is supplied, the default value for the application will be used in combination with any customer or company priceLists. This applies to both configurations.

cultureCode
string

Specifies in which language to display culture specific information. If none is supplied, value is resolved from Application.

currencyId
string

Internal id to specify in which currency to display prices. If none is supplied, value is resolved from Application. Note that if price is specified on items to insert, then it must be in the same currency.

Request Body schema:

The Subscription to create.

Id
integer or null <int32>

A unique internal id for this Subscription. When creating new Subscription this should be left as null and will be ignored.

Name
string

The name of the Subscription. This will also be the name of the template basket. Can be used to distinguish Subscriptions from each other. MaxLength: 50

object <Basket> (Basket)
object <SubscriptionType> (SubscriptionType)
StatusId
integer <int32>

The internal status id for this Subscription. When a Subscription is created the status will be 0 (Inactive) and ignored. To activate a Subscription it must pass through the Checkout process. See ListSubscriptionStatus for valid values. Can only be changed between Active and Paused. To delete a Subscription use DeleteSubscription.

HoldUntilDate
string or null <date-time>

A date used to temporarily pause the Subscription and automatically activate it again on the specified date. If no HoldFromDate is specified the pause will start immediately.

StartDate
string or null <date-time>

An optional start date for the Subscription. The Subscription can be activated but no orders will be processed before this date if specified. Can only be changed if a specified date has not passed or if the Subscription is still inactive. If no StartDate is specified when activating the Subscription this will be set to the activation date.

EndDate
string or null <date-time>

An optional end date for the Subscription. The Subscription will be deleted after this date if specified. See DeleteSubscription for details about deleting subscriptions.

Array of objects <SubscriptionSchedule> (SubscriptionSchedule)

The schedules for this Subscription. Any Subscription must have at least one schedule when activated.

HoldFromDate
string or null <date-time>

A date used to temporarily pause the Subscription from the specified date and automatically activate it again on HoldUtilDate. If this is specified HoldUntilDate must also be specified.

NextRun
string or null <date-time>

Calculated date for next time an order will be created by this subscription

Responses
200

Success

400

Bad Request

Key: BasketItemNotBuyable. Gets raised when the basket item is not buyable or when it is inactive.

Key: BasketItemQuantityLessThanZero. Gets raised when the basket item quantity is less than zero.

500

Internal Server Error

post/ShoppingService.svc/rest/CreateSubscription
Request samples
{
  • "Id": 0,
  • "Name": "string",
  • "TemplateBasket": {
    },
  • "Type": {
    },
  • "StatusId": 0,
  • "HoldUntilDate": "2019-08-24T14:15:22Z",
  • "StartDate": "2019-08-24T14:15:22Z",
  • "EndDate": "2019-08-24T14:15:22Z",
  • "Schedules": [
    ],
  • "HoldFromDate": "2019-08-24T14:15:22Z",
  • "NextRun": "2019-08-24T14:15:22Z"
}
Response samples
{
  • "Id": 0,
  • "Name": "string",
  • "TemplateBasket": {
    },
  • "Type": {
    },
  • "StatusId": 0,
  • "HoldUntilDate": "2019-08-24T14:15:22Z",
  • "StartDate": "2019-08-24T14:15:22Z",
  • "EndDate": "2019-08-24T14:15:22Z",
  • "Schedules": [
    ],
  • "HoldFromDate": "2019-08-24T14:15:22Z",
  • "NextRun": "2019-08-24T14:15:22Z"
}