Build-a-Box & Bundles
Retrieve Build-A-Box bundle details by handle
Reads a Build-A-Box by its handle, which is the box’s uniqueRef (the Ref column of the Appstle app’s Build-A-Box list). This is an Admin API call for your server: never put the API key in theme or browser code.
The response holds the box in bundle, its plan group in subscription and the plan group’s products in products. bundle is the body to send back to PUT /api/external/v2/build-a-box.
Behavior:
- The call answers
404while the box is off, unlessthirdPartyRuleistrue. To read a box that is off, useGET /api/external/v2/build-a-box/{id}. - The call also answers
404for a handle that isn’t one of your boxes, and when the box’ssubscriptionIdisn’t one of your plan groups. - A value made only of digits is read as an
id, and any other value as auniqueRef. A box read by itsidcomes back without thebundlewrapper, and a box whoseuniqueRefis only digits can be read only by itsid.
Authentication: Requires a valid X-API-Key header.
GET
/
api
/
external
/
v2
/
build-a-box
/
{handle}
Retrieve Build-A-Box bundle details by handle
curl --request GET \
--url https://subscription-admin.appstle.com/api/external/v2/build-a-box/{handle}import requests
url = "https://subscription-admin.appstle.com/api/external/v2/build-a-box/{handle}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://subscription-admin.appstle.com/api/external/v2/build-a-box/{handle}', 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/{handle}';
const options = {method: 'GET'};
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/{handle}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://subscription-admin.appstle.com/api/external/v2/build-a-box/{handle}"
req, _ := http.NewRequest("GET", url, nil)
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/{handle}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"bundle": {
"allowOneTimePurchase": false,
"buildABoxType": "SINGLE_PRODUCT",
"bundleRedirect": "CART",
"chooseProductsText": "Pick your coffees",
"discount": 0,
"id": 21105,
"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\":\"2\",\"products\":[{\"id\":15386745078064,\"type\":\"PRODUCT\",\"title\":\"Colombia Coffee\",\"productHandle\":\"colombia-coffee\",\"status\":\"ACTIVE\"}]}]",
"subscriptionBundlingEnabled": true,
"subscriptionId": 80297427248,
"trackInventory": false,
"uniqueRef": "hi7utqdu"
},
"products": [
{
"productHandle": "house-blend-coffee",
"productId": 15386633601328,
"productTitle": "House Blend Coffee"
}
],
"subscription": {
"groupName": "Coffee Subscription",
"id": 284357,
"productCount": 8,
"subscriptionId": 80297427248
}
}Response
The box, in bundle, with its plan group and the plan group's products
⌘I
Retrieve Build-A-Box bundle details by handle
curl --request GET \
--url https://subscription-admin.appstle.com/api/external/v2/build-a-box/{handle}import requests
url = "https://subscription-admin.appstle.com/api/external/v2/build-a-box/{handle}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://subscription-admin.appstle.com/api/external/v2/build-a-box/{handle}', 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/{handle}';
const options = {method: 'GET'};
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/{handle}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://subscription-admin.appstle.com/api/external/v2/build-a-box/{handle}"
req, _ := http.NewRequest("GET", url, nil)
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/{handle}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"bundle": {
"allowOneTimePurchase": false,
"buildABoxType": "SINGLE_PRODUCT",
"bundleRedirect": "CART",
"chooseProductsText": "Pick your coffees",
"discount": 0,
"id": 21105,
"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\":\"2\",\"products\":[{\"id\":15386745078064,\"type\":\"PRODUCT\",\"title\":\"Colombia Coffee\",\"productHandle\":\"colombia-coffee\",\"status\":\"ACTIVE\"}]}]",
"subscriptionBundlingEnabled": true,
"subscriptionId": 80297427248,
"trackInventory": false,
"uniqueRef": "hi7utqdu"
},
"products": [
{
"productHandle": "house-blend-coffee",
"productId": 15386633601328,
"productTitle": "House Blend Coffee"
}
],
"subscription": {
"groupName": "Coffee Subscription",
"id": 284357,
"productCount": 8,
"subscriptionId": 80297427248
}
}