Skip to main content

Create a product

POST 

https://euwest.api.elasticpath.com/v2/subscriptions/products

Create a product

Request

Responses

Success. The product is created.

Authorization: http

name: BearerTokentype: httpscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://euwest.api.elasticpath.com/v2/subscriptions/products");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"subscription_product\",\n \"attributes\": {\n \"external_ref\": \"abc123\",\n \"name\": \"Magazine\",\n \"description\": \"A lovely magazine that is published every month.\",\n \"sku\": \"MAGAZINE1\",\n \"main_image\": \"https://magazine.com/cover.jpg\",\n \"price\": {\n \"USD\": {\n \"amount\": 100,\n \"includes_tax\": false\n },\n \"GBP\": {\n \"amount\": 90,\n \"includes_tax\": true\n }\n },\n \"price_units\": {\n \"unit\": \"day\",\n \"amount\": 7\n }\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
— query
Body
{
  "data": {
    "type": "subscription_product",
    "attributes": {
      "external_ref": "abc123",
      "name": "Magazine",
      "description": "A lovely magazine that is published every month.",
      "sku": "MAGAZINE1",
      "main_image": "https://magazine.com/cover.jpg",
      "price": {
        "USD": {
          "amount": 100,
          "includes_tax": false
        },
        "GBP": {
          "amount": 90,
          "includes_tax": true
        }
      },
      "price_units": {
        "unit": "day",
        "amount": 7
      }
    }
  }
}
ResponseClear

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

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.