Update an existing Build-A-Box subscription bundle
Replaces a whole Build-A-Box with the body you send. This is not a partial update: a field you leave out is cleared. A missing uniqueRef gets a new random value, which breaks the box’s page link and every cart, script and subscription line that carries the old value as _appstle-bb-id. To repair the box, send its old uniqueRef in another PUT.
Read the box first with GET /api/external/v2/build-a-box/{handle}, where the handle is the uniqueRef. Change the fields you need in bundle, and send all of bundle back. While the box is off, that call answers 404: read the box with GET /api/external/v2/build-a-box/{id} instead, and send back the whole response.
Behavior:
- The body must carry the box’s
id. A body without it returns400witherrorKeyidnull; anidthat isn’t one of your boxes returns400witherrorKeyidnotfound. - The last save wins. If the box changes in the Appstle app between your read and your
PUT, yourPUTundoes that change. APUTof an older copy also undoes any change made withPUT /api/external/v2/subscription-bundling/update. shopis optional. When you send it, it must be your store’s.myshopify.comdomain: the domain of another store returns403.discount, or thediscountof a tier intieredDiscount, outside 0 to 100 returns400witherrorKeyinvaliddiscount. AtieredDiscountthat isn’t a JSON array, or a tier without a whole-numberquantityof 1 or more, returns400witherrorKeyinvalidtierdiscount.- Product IDs and
subscriptionIdaren’t checked. A productidthat doesn’t exist in Shopify saves without an error. AsubscriptionIdthat isn’t one of your plan groups saves, but the box then answers404when you read it by handle. singleProductSettings,tieredDiscountandsellingPlanIdsare JSON strings.sellingPlanIdsmaps a parent product’sidto the selling plan IDs the box page offers for it. Send back the value thatGETreturned.- A box with
thirdPartyRuleset totruebelongs to the Appstle Bundles app. Bundles sends the whole box again each time the merchant saves it and replaces your change.
Authentication: Requires a valid X-API-Key header with a Read & Write key.
curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/build-a-box \
--header 'Content-Type: application/json' \
--data '
{
"shop": "<string>"
}
'import requests
url = "https://subscription-admin.appstle.com/api/external/v2/build-a-box"
payload = { "shop": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({shop: '<string>'})
};
fetch('https://subscription-admin.appstle.com/api/external/v2/build-a-box', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://subscription-admin.appstle.com/api/external/v2/build-a-box';
const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({shop: '<string>'})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://subscription-admin.appstle.com/api/external/v2/build-a-box",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'shop' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://subscription-admin.appstle.com/api/external/v2/build-a-box"
payload := strings.NewReader("{\n \"shop\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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))
}require 'uri'
require 'net/http'
url = URI("https://subscription-admin.appstle.com/api/external/v2/build-a-box")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"shop\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"allowOneTimePurchase": false,
"buildABoxType": "SINGLE_PRODUCT",
"bundleRedirect": "CART",
"chooseProductsText": "Pick your coffees",
"discount": 0,
"id": 21107,
"minOrderAmount": 0,
"minProductCount": 0,
"name": "Roasters choice box",
"proceedToCheckoutButtonText": "Go to cart",
"productViewStyle": "QUICK_ADD",
"shop": "your-store.myshopify.com",
"singleProductSettings": "[{\"sourceProduct\":{\"id\":15386745176368,\"title\":\"Ethiopia Coffee\",\"handle\":\"ethiopia-coffee\"},\"minQuantity\":\"1\",\"maxQuantity\":\"4\",\"products\":[{\"id\":15386745078064,\"type\":\"PRODUCT\",\"title\":\"Colombia Coffee\",\"productHandle\":\"colombia-coffee\",\"status\":\"ACTIVE\"}]}]",
"subscriptionBundlingEnabled": true,
"subscriptionId": 80297427248,
"trackInventory": false,
"uniqueRef": "pfoqel5h"
}{
"entityName": "subscriptionBundling",
"errorKey": "idnotfound",
"message": "Entity not found",
"params": "subscriptionBundling",
"status": 400,
"title": "Entity not found",
"type": "https://appstle.com/problem/problem-with-message"
}Body
Response
The box was replaced. The body is the saved box.
curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/build-a-box \
--header 'Content-Type: application/json' \
--data '
{
"shop": "<string>"
}
'import requests
url = "https://subscription-admin.appstle.com/api/external/v2/build-a-box"
payload = { "shop": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({shop: '<string>'})
};
fetch('https://subscription-admin.appstle.com/api/external/v2/build-a-box', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://subscription-admin.appstle.com/api/external/v2/build-a-box';
const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({shop: '<string>'})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://subscription-admin.appstle.com/api/external/v2/build-a-box",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'shop' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://subscription-admin.appstle.com/api/external/v2/build-a-box"
payload := strings.NewReader("{\n \"shop\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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))
}require 'uri'
require 'net/http'
url = URI("https://subscription-admin.appstle.com/api/external/v2/build-a-box")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"shop\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"allowOneTimePurchase": false,
"buildABoxType": "SINGLE_PRODUCT",
"bundleRedirect": "CART",
"chooseProductsText": "Pick your coffees",
"discount": 0,
"id": 21107,
"minOrderAmount": 0,
"minProductCount": 0,
"name": "Roasters choice box",
"proceedToCheckoutButtonText": "Go to cart",
"productViewStyle": "QUICK_ADD",
"shop": "your-store.myshopify.com",
"singleProductSettings": "[{\"sourceProduct\":{\"id\":15386745176368,\"title\":\"Ethiopia Coffee\",\"handle\":\"ethiopia-coffee\"},\"minQuantity\":\"1\",\"maxQuantity\":\"4\",\"products\":[{\"id\":15386745078064,\"type\":\"PRODUCT\",\"title\":\"Colombia Coffee\",\"productHandle\":\"colombia-coffee\",\"status\":\"ACTIVE\"}]}]",
"subscriptionBundlingEnabled": true,
"subscriptionId": 80297427248,
"trackInventory": false,
"uniqueRef": "pfoqel5h"
}{
"entityName": "subscriptionBundling",
"errorKey": "idnotfound",
"message": "Entity not found",
"params": "subscriptionBundling",
"status": 400,
"title": "Entity not found",
"type": "https://appstle.com/problem/problem-with-message"
}