Products
POST /products/{productId}/variant-options
Assign variant options to a product
POST
/
products
/
{productId}
/
variant-options
cURL
curl --request POST \
--url https://admin.fanfare.io/api/products/{productId}/variant-options \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"options": [
{
"optionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"required": true,
"sortOrder": 123
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
options: [
{
optionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
required: true,
sortOrder: 123
}
]
})
};
fetch('https://admin.fanfare.io/api/products/{productId}/variant-options', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://admin.fanfare.io/api/products/{productId}/variant-options"
payload = { "options": [
{
"optionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"required": True,
"sortOrder": 123
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://admin.fanfare.io/api/products/{productId}/variant-options"
payload := strings.NewReader("{\n \"options\": [\n {\n \"optionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"required\": true,\n \"sortOrder\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"assignments": [
{
"option": {
"archived": true,
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"displayName": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isRestricted": true,
"name": "<string>",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sortOrder": 123,
"updatedAt": "2023-11-07T05:31:56Z",
"updatedBy": "<string>"
},
"optionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"required": true,
"sortOrder": 123,
"values": [
{
"archived": true,
"colorHex": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"displayValue": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isCentrallyManaged": true,
"optionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sortOrder": 123,
"value": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"updatedBy": "<string>"
}
]
}
]
}{
"error": "validation_error",
"issues": [
{
"expected": "<string>",
"kind": "<string>",
"message": "<string>",
"path": [
{
"input": "<unknown>",
"key": "<string>",
"origin": "<string>",
"type": "<string>"
}
],
"received": "<string>",
"type": "<string>"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Fanfare secret key. Keep secret credentials on your server.
Path Parameters
Body
application/json
Show child attributes
Show child attributes
Response
Variant options assigned successfully
Show child attributes
Show child attributes
⌘I
cURL
curl --request POST \
--url https://admin.fanfare.io/api/products/{productId}/variant-options \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"options": [
{
"optionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"required": true,
"sortOrder": 123
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
options: [
{
optionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
required: true,
sortOrder: 123
}
]
})
};
fetch('https://admin.fanfare.io/api/products/{productId}/variant-options', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://admin.fanfare.io/api/products/{productId}/variant-options"
payload = { "options": [
{
"optionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"required": True,
"sortOrder": 123
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://admin.fanfare.io/api/products/{productId}/variant-options"
payload := strings.NewReader("{\n \"options\": [\n {\n \"optionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"required\": true,\n \"sortOrder\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"assignments": [
{
"option": {
"archived": true,
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"displayName": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isRestricted": true,
"name": "<string>",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sortOrder": 123,
"updatedAt": "2023-11-07T05:31:56Z",
"updatedBy": "<string>"
},
"optionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"required": true,
"sortOrder": 123,
"values": [
{
"archived": true,
"colorHex": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"displayValue": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isCentrallyManaged": true,
"optionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sortOrder": 123,
"value": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"updatedBy": "<string>"
}
]
}
]
}{
"error": "validation_error",
"issues": [
{
"expected": "<string>",
"kind": "<string>",
"message": "<string>",
"path": [
{
"input": "<unknown>",
"key": "<string>",
"origin": "<string>",
"type": "<string>"
}
],
"received": "<string>",
"type": "<string>"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}