curl --request POST \
--url https://api.fabric.inc/v3/products/{id}/bundles/actions/attach \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"products": [
{
"id": "AASSBCC12334FCD12334V",
"quantity": 2
}
]
}
'import requests
url = "https://api.fabric.inc/v3/products/{id}/bundles/actions/attach"
payload = { "products": [
{
"id": "AASSBCC12334FCD12334V",
"quantity": 2
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({products: [{id: 'AASSBCC12334FCD12334V', quantity: 2}]})
};
fetch('https://api.fabric.inc/v3/products/{id}/bundles/actions/attach', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fabric.inc/v3/products/{id}/bundles/actions/attach",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'products' => [
[
'id' => 'AASSBCC12334FCD12334V',
'quantity' => 2
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fabric.inc/v3/products/{id}/bundles/actions/attach"
payload := strings.NewReader("{\n \"products\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\",\n \"quantity\": 2\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))
}HttpResponse<String> response = Unirest.post("https://api.fabric.inc/v3/products/{id}/bundles/actions/attach")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"products\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\",\n \"quantity\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/products/{id}/bundles/actions/attach")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"products\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\",\n \"quantity\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Request is invalid",
"type": "Bad request",
"errors": [
{
"type": "CLIENT_ERROR",
"message": "Invalid request. Unable to find or create product"
}
]
}{
"type": "UNAUTHORIZED_ERROR",
"message": "The requester is unauthorized"
}{
"type": "REQUEST_DENIED",
"message": "User doesn't have the required permission"
}{
"type": "NOT_FOUND",
"message": "Resource not found"
}{
"type": "PAYLOAD_LIMIT_EXCEEDED_ERROR",
"message": "Payload exceeds maximum configured size"
}{
"message": "Internal Server Error",
"type": "SERVER_ERROR"
}Add Products to Bundle by ID
Creating a bundle of two or more complementary products, sold as a single package, is a widely adopted sales and marketing strategy. For example, a laptop is bundled with a carrying case and wireless mouse. This makes it convenient for shoppers to purchase them together. With this endpoint, you can add up to 25 products in a bundle that can be sold together. Note:
1. At least one product must be added.
2. If you don’t have product ID, use the corresponding SKU-based endpoint - POST /products/sku/{sku}/bundles/actions/attach.
curl --request POST \
--url https://api.fabric.inc/v3/products/{id}/bundles/actions/attach \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"products": [
{
"id": "AASSBCC12334FCD12334V",
"quantity": 2
}
]
}
'import requests
url = "https://api.fabric.inc/v3/products/{id}/bundles/actions/attach"
payload = { "products": [
{
"id": "AASSBCC12334FCD12334V",
"quantity": 2
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({products: [{id: 'AASSBCC12334FCD12334V', quantity: 2}]})
};
fetch('https://api.fabric.inc/v3/products/{id}/bundles/actions/attach', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fabric.inc/v3/products/{id}/bundles/actions/attach",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'products' => [
[
'id' => 'AASSBCC12334FCD12334V',
'quantity' => 2
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fabric.inc/v3/products/{id}/bundles/actions/attach"
payload := strings.NewReader("{\n \"products\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\",\n \"quantity\": 2\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))
}HttpResponse<String> response = Unirest.post("https://api.fabric.inc/v3/products/{id}/bundles/actions/attach")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"products\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\",\n \"quantity\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/products/{id}/bundles/actions/attach")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"products\": [\n {\n \"id\": \"AASSBCC12334FCD12334V\",\n \"quantity\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Request is invalid",
"type": "Bad request",
"errors": [
{
"type": "CLIENT_ERROR",
"message": "Invalid request. Unable to find or create product"
}
]
}{
"type": "UNAUTHORIZED_ERROR",
"message": "The requester is unauthorized"
}{
"type": "REQUEST_DENIED",
"message": "User doesn't have the required permission"
}{
"type": "NOT_FOUND",
"message": "Resource not found"
}{
"type": "PAYLOAD_LIMIT_EXCEEDED_ERROR",
"message": "Payload exceeds maximum configured size"
}{
"message": "Internal Server Error",
"type": "SERVER_ERROR"
}Authorizations
S2S access token (JWT) from fabric Identity service (during Login)
Headers
A header used by fabric to identify the tenant making the request. You must include tenant id in the authentication header for an API request to access any of fabric’s endpoints. You can retrieve the tenant id , which is also called account id, from Copilot. This header is required.
"517fa9dfd42d8b00g1o3k312"
Unique request ID
"263e731c-45c8-11ed-b878-0242ac120002"
Path Parameters
24-character system-generated product ID.
Query Parameters
Comma-separated statuses indicating the preferred order of the product versions considered for this operation (endpoint action). For example,
1. When the status is DRAFT, this operations will only apply to the Draft version of product, if it exists
2. When the status is LIVE, this operation will only apply to the Live version of the product, if it exists
3 When the status is LIVE,DRAFT, this operation will prioritize Live version first, if it exists. Otherwise, the Draft version is considered.
4 When the status is DRAFT,LIVE this operation will prioritize the Draft version first, if it exists. Otherwise, the Live version is considered.
"DRAFT"
Body
1Show child attributes
Show child attributes
Response
OK
Was this page helpful?
