Create a product
POSThttps://euwest.api.elasticpath.com/v2/subscriptions/products
Create a product
Request
Query Parameters
filter string
- application/json
Body
data ProductCreaterequired
Responses
- 201
- 400
- 500
Success. The product is created.
- application/json
- Schema
- Example (from schema)
Schema
data Product
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"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
},
"updated_at": "2017-01-10T11:41:19.244842Z",
"created_at": "2017-01-10T11:41:19.244842Z"
},
"meta": {
"display_price": {
"without_tax": {
"amount": 100,
"currency": "USD",
"formatted": "$1.00"
},
"with_tax": {
"amount": 110,
"currency": "USD",
"formatted": "$1.10"
}
},
"owner": "store",
"timestamps": {
"updated_at": "2017-01-10T11:41:19.244842Z",
"created_at": "2017-01-10T11:41:19.244842Z"
}
}
}
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- missing-name
Schema
errors Error[]required
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Validation Error",
"status": "400",
"detail": "data.attributes.name: \"name\" is required"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
errors Error[]required
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Internal Server Error",
"status": "500"
}
]
}
Authorization: http
name: BearerTokentype: httpscheme: bearer
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X POST 'https://euwest.api.elasticpath.com/v2/subscriptions/products' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
"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