Subscription Contracts
Replace all line item attributes in bulk across subscription contracts
This API replaces all existing attributes for the specified line items within subscription contracts. Use carefully, as any attributes not included in the request will be removed.
PUT
/
api
/
external
/
v2
/
subscription-contracts-bulk-update-line-item-attributes
Replace all line item attributes in bulk across subscription contracts
curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-bulk-update-line-item-attributes \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
[
{
"key": "color",
"value": "red"
},
{
"key": "size",
"value": "M"
}
]
'import requests
url = "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-bulk-update-line-item-attributes"
payload = [
{
"key": "color",
"value": "red"
},
{
"key": "size",
"value": "M"
}
]
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([{key: 'color', value: 'red'}, {key: 'size', value: 'M'}])
};
fetch('https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-bulk-update-line-item-attributes', 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/subscription-contracts-bulk-update-line-item-attributes';
const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([{key: 'color', value: 'red'}, {key: 'size', value: 'M'}])
};
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/subscription-contracts-bulk-update-line-item-attributes",
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([
[
'key' => 'color',
'value' => 'red'
],
[
'key' => 'size',
'value' => 'M'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-api-key>"
],
]);
$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/subscription-contracts-bulk-update-line-item-attributes"
payload := strings.NewReader("[\n {\n \"key\": \"color\",\n \"value\": \"red\"\n },\n {\n \"key\": \"size\",\n \"value\": \"M\"\n }\n]")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
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/subscription-contracts-bulk-update-line-item-attributes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"key\": \"color\",\n \"value\": \"red\"\n },\n {\n \"key\": \"size\",\n \"value\": \"M\"\n }\n]"
response = http.request(request)
puts response.read_body"<string>"Headers
API Key for authentication
Query Parameters
Optional comma-separated list of subscription contract IDs to update. Example: 32665403611,3266540311,326654036123. Ignored if allSubscriptions=true.
If true, updates all active subscriptions of the shop. If false (default), updates only the provided contractId or contractIds.
Body
application/json
A JSON array of attributes. ⚠️ Note: Providing this array will replace all existing attributes in the specified contract. Add or update attributes carefully, as any attributes not included in the request will be removed.
Response
200 - */*
OK
The response is of type string.
⌘I
Replace all line item attributes in bulk across subscription contracts
curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-bulk-update-line-item-attributes \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
[
{
"key": "color",
"value": "red"
},
{
"key": "size",
"value": "M"
}
]
'import requests
url = "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-bulk-update-line-item-attributes"
payload = [
{
"key": "color",
"value": "red"
},
{
"key": "size",
"value": "M"
}
]
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([{key: 'color', value: 'red'}, {key: 'size', value: 'M'}])
};
fetch('https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-bulk-update-line-item-attributes', 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/subscription-contracts-bulk-update-line-item-attributes';
const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([{key: 'color', value: 'red'}, {key: 'size', value: 'M'}])
};
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/subscription-contracts-bulk-update-line-item-attributes",
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([
[
'key' => 'color',
'value' => 'red'
],
[
'key' => 'size',
'value' => 'M'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-api-key>"
],
]);
$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/subscription-contracts-bulk-update-line-item-attributes"
payload := strings.NewReader("[\n {\n \"key\": \"color\",\n \"value\": \"red\"\n },\n {\n \"key\": \"size\",\n \"value\": \"M\"\n }\n]")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
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/subscription-contracts-bulk-update-line-item-attributes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"key\": \"color\",\n \"value\": \"red\"\n },\n {\n \"key\": \"size\",\n \"value\": \"M\"\n }\n]"
response = http.request(request)
puts response.read_body"<string>"