Create a variation option
POSThttps://euwest.api.elasticpath.com/pcm/variations/:variationID/options
Create a variation option
Request
Path Parameters
variationID stringrequired
A unique identifier for the variation.
- application/json
Body
data objectrequired
Responses
- 201
- 422
- 500
Successfully returns the created variation option.
- application/json
- Schema
- Example (auto)
- created-variation-option
Schema
data objectrequired
{
"data": {
"id": "string",
"type": "product-variation-option",
"attributes": {
"name": "string",
"description": "string",
"sort_order": 0
},
"meta": {
"owner": "organization",
"created_at": "2020-09-22T09:00:00",
"updated_at": "2020-09-22T09:00:00"
}
}
}
{
"data": {
"type": "product-variation-option",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"attributes": {
"description": "Our most popular color",
"name": "Blue",
"sort_order": 0
},
"meta": {
"owner": "store",
"created_at": "2024-01-25T11:25:38.001Z",
"updated_at": "2024-01-25T11:25:38.001Z"
}
}
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (auto)
- failed-validation
Schema
errors undefined[]required
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Failed Validation",
"status": "422",
"detail": "<XYZ> can not be empty"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (auto)
- internal-server-error
Schema
errors undefined[]required
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"status": "500",
"title": "Internal Server Error",
"detail": "There was an internal server error, you can report with your request id.",
"request_id": "635da56d-75a1-43cd-b696-7ab119756b3a"
}
]
}
Authorization: http
name: bearerAuthtype: httpscheme: bearer
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://euwest.api.elasticpath.com/pcm/variations/:variationID/options");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"product-variation-option\",\n \"attributes\": {\n \"name\": \"string\",\n \"sort_order\": 0,\n \"description\": \"string\"\n }\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear