Skip to main content

Replace a product

PUT 

https://euwest.api.elasticpath.com/v2/subscriptions/offerings/:offering_uuid/products/replace

After saving an offering, you can replace its products at any time.

Replacing products on an offering does not affect any existing active subscriptions. The changes take effect on all new subscriptions that are created.

Request

Path Parameters

    offering_uuid UUIDrequired

    The unique identifier of the offering.

Body

    data OfferingProductReplacerequired

    A list of product IDs to replace on the offering. See List Products.

    productsUUID (string)[]required

    Possible values: >= 1

Responses

Success. The subscription product is replaced on the offering.

Schema
    data OfferingProduct[]
  • Array [
  • idUUID (string)

    The unique identifier.

    Example: 11111111-2222-3333-4444-555555555555
    typeSubscriptionOfferingProductType (string)required

    Possible values: [subscription_offering_product]

    Example: subscription_offering_product
    attributes OfferingProductResponseAttributes
    external_refExternalRef (string)

    A unique attribute that you could use to contain information from another company system, for example. The maximum length is 2048 characters.

    Possible values: <= 2048 characters

    Example: abc123
    namestringrequired

    The name of the product.

    Possible values: >= 3 characters and <= 1024 characters

    Example: Magazine
    descriptionstring

    The product or service description to display to customers.

    Possible values: <= 1024 characters

    Example: A lovely magazine that is published every month.
    skustring

    A stock keeping unit for the product, if appropriate.

    Possible values: <= 1024 characters

    Example: MAGAZINE1
    main_imageuri

    A URL from which an image or file for the product can be fetched. You can either upload your images and files to Commerce using the Commerce Files API or you can use your own content delivery network. If you are using the Commerce Files API, use Create a File to upload your file and return an HREF link in the response. An extensive range of media and file extensions are supported.

    Possible values: <= 1024 characters

    Example: https://magazine.com/cover.jpg
    price Price
    property name* object

    The base price.

    amountint64required

    The value as a whole number of the currency's smallest subdivision.

    Example: 100
    includes_taxboolean

    Indicates whether the amount includes any taxes.

    Example: true
    price_units object

    The timeframe during which the product price is applicable. For example, for a streaming service, the price is $12.99 and the unit is months and the amount is 1. In other words, the streaming service is available for $12.99 a month. You may want to specify a unit price if you have many products that all have different prices. Rather than having to create separate plans for each product, you can specify the timeframe during which the product price is applicable and then create one plan that determines the billing frequency for those products.

    unitstringrequired

    A unit of time.

    Possible values: [day, month]

    Example: day
    amountintegerrequired

    The number of days or months the period covers.

    Possible values: >= 1

    Example: 7
    updated_atstringrequired

    The date and time a resource was updated.

    Example: 2017-01-10T11:41:19.244842Z
    created_atstringrequired

    The date and time a resource was created.

    Example: 2017-01-10T11:41:19.244842Z
    feature_configurations objectrequired

    A map of configurations indicating which features are available for the product

    property name* FeatureProductConfiguration
    typerequired

    Possible values: [access, promotion, usage]

    object
    relationships Relationships

    Relationships are established between different subscription entities. For example, a product and a plan are related to an offering, as both are attached to it.

    property name* Relationship
    anyOf
    meta ProductMetarequired
    display_price DisplayPrice
    without_tax PriceFormatting
    amountint64required

    The unformatted amount for the objects.

    Example: 100
    currencystringrequired

    The three-letter ISO currency code in uppercase, associated with a price.

    Example: USD
    formattedstringrequired

    The formatted amount for the objects.

    Example: $1.00
    with_tax PriceFormatting
    amountint64required

    The unformatted amount for the objects.

    Example: 100
    currencystringrequired

    The three-letter ISO currency code in uppercase, associated with a price.

    Example: USD
    formattedstringrequired

    The formatted amount for the objects.

    Example: $1.00
    ownerstringrequired

    The owner of a resource, either store or organization.

    Example: store
    timestamps Timestampsrequired
    updated_atstringrequired

    The date and time a resource was updated.

    Example: 2017-01-10T11:41:19.244842Z
    created_atstringrequired

    The date and time a resource was created.

    Example: 2017-01-10T11:41:19.244842Z
  • ]

Authorization: http

name: BearerTokentype: httpscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, "https://euwest.api.elasticpath.com/v2/subscriptions/offerings/:offering_uuid/products/replace");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"products\": [\n \"11111111-2222-3333-4444-555555555555\"\n ]\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://euwest.api.elasticpath.com/v2
Auth
Parameters
— pathrequired
Body
{
  "data": {
    "products": [
      "11111111-2222-3333-4444-555555555555"
    ]
  }
}
ResponseClear

Click the Send API Request button above and see the response here!