cURL
curl --request POST \
--url https://api.juo.io/customer/v1/subscriptions/{subscriptionId}/items \
--header 'Content-Type: application/json' \
--header 'X-Delegated-Token: <api-key>' \
--header 'X-Tenant-ID: <x-tenant-id>' \
--data '
{
"variant": "<string>",
"quantity": 1,
"recurringCycleLimit": 3
}
'import requests
url = "https://api.juo.io/customer/v1/subscriptions/{subscriptionId}/items"
payload = {
"variant": "<string>",
"quantity": 1,
"recurringCycleLimit": 3
}
headers = {
"X-Tenant-ID": "<x-tenant-id>",
"X-Delegated-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Tenant-ID': '<x-tenant-id>',
'X-Delegated-Token': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({variant: '<string>', quantity: 1, recurringCycleLimit: 3})
};
fetch('https://api.juo.io/customer/v1/subscriptions/{subscriptionId}/items', 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.juo.io/customer/v1/subscriptions/{subscriptionId}/items",
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([
'variant' => '<string>',
'quantity' => 1,
'recurringCycleLimit' => 3
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Delegated-Token: <api-key>",
"X-Tenant-ID: <x-tenant-id>"
],
]);
$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.juo.io/customer/v1/subscriptions/{subscriptionId}/items"
payload := strings.NewReader("{\n \"variant\": \"<string>\",\n \"quantity\": 1,\n \"recurringCycleLimit\": 3\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tenant-ID", "<x-tenant-id>")
req.Header.Add("X-Delegated-Token", "<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))
}HttpResponse<String> response = Unirest.post("https://api.juo.io/customer/v1/subscriptions/{subscriptionId}/items")
.header("X-Tenant-ID", "<x-tenant-id>")
.header("X-Delegated-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"variant\": \"<string>\",\n \"quantity\": 1,\n \"recurringCycleLimit\": 3\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.juo.io/customer/v1/subscriptions/{subscriptionId}/items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tenant-ID"] = '<x-tenant-id>'
request["X-Delegated-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variant\": \"<string>\",\n \"quantity\": 1,\n \"recurringCycleLimit\": 3\n}"
response = http.request(request)
puts response.read_body{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"resource": "subscription-item",
"title": "Monthly Coffee Blend",
"subtitle": "250g / Ground",
"quantity": 1,
"totalPrice": 24.99,
"recurringCycleLimit": 3,
"canceledAt": "2023-11-07T05:31:56Z",
"billingPolicy": {
"interval": "DAY",
"intervalCount": 2,
"anchors": [
{
"type": "WEEKDAY",
"day": 16,
"month": 6,
"cutoffDay": 16
}
],
"minCycles": 2,
"maxCycles": 2
},
"deliveryPolicy": {
"interval": "DAY",
"intervalCount": 2,
"anchors": [
{
"type": "WEEKDAY",
"day": 16,
"month": 6,
"cutoffDay": 16
}
]
},
"customAttributes": [
{
"key": "<string>",
"value": "<string>"
}
],
"variant": "<string>",
"product": "<string>"
}Subscription items
Create a subscription item
Used to create a subscription item.
POST
/
subscriptions
/
{subscriptionId}
/
items
cURL
curl --request POST \
--url https://api.juo.io/customer/v1/subscriptions/{subscriptionId}/items \
--header 'Content-Type: application/json' \
--header 'X-Delegated-Token: <api-key>' \
--header 'X-Tenant-ID: <x-tenant-id>' \
--data '
{
"variant": "<string>",
"quantity": 1,
"recurringCycleLimit": 3
}
'import requests
url = "https://api.juo.io/customer/v1/subscriptions/{subscriptionId}/items"
payload = {
"variant": "<string>",
"quantity": 1,
"recurringCycleLimit": 3
}
headers = {
"X-Tenant-ID": "<x-tenant-id>",
"X-Delegated-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Tenant-ID': '<x-tenant-id>',
'X-Delegated-Token': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({variant: '<string>', quantity: 1, recurringCycleLimit: 3})
};
fetch('https://api.juo.io/customer/v1/subscriptions/{subscriptionId}/items', 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.juo.io/customer/v1/subscriptions/{subscriptionId}/items",
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([
'variant' => '<string>',
'quantity' => 1,
'recurringCycleLimit' => 3
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Delegated-Token: <api-key>",
"X-Tenant-ID: <x-tenant-id>"
],
]);
$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.juo.io/customer/v1/subscriptions/{subscriptionId}/items"
payload := strings.NewReader("{\n \"variant\": \"<string>\",\n \"quantity\": 1,\n \"recurringCycleLimit\": 3\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tenant-ID", "<x-tenant-id>")
req.Header.Add("X-Delegated-Token", "<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))
}HttpResponse<String> response = Unirest.post("https://api.juo.io/customer/v1/subscriptions/{subscriptionId}/items")
.header("X-Tenant-ID", "<x-tenant-id>")
.header("X-Delegated-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"variant\": \"<string>\",\n \"quantity\": 1,\n \"recurringCycleLimit\": 3\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.juo.io/customer/v1/subscriptions/{subscriptionId}/items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tenant-ID"] = '<x-tenant-id>'
request["X-Delegated-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variant\": \"<string>\",\n \"quantity\": 1,\n \"recurringCycleLimit\": 3\n}"
response = http.request(request)
puts response.read_body{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"resource": "subscription-item",
"title": "Monthly Coffee Blend",
"subtitle": "250g / Ground",
"quantity": 1,
"totalPrice": 24.99,
"recurringCycleLimit": 3,
"canceledAt": "2023-11-07T05:31:56Z",
"billingPolicy": {
"interval": "DAY",
"intervalCount": 2,
"anchors": [
{
"type": "WEEKDAY",
"day": 16,
"month": 6,
"cutoffDay": 16
}
],
"minCycles": 2,
"maxCycles": 2
},
"deliveryPolicy": {
"interval": "DAY",
"intervalCount": 2,
"anchors": [
{
"type": "WEEKDAY",
"day": 16,
"month": 6,
"cutoffDay": 16
}
]
},
"customAttributes": [
{
"key": "<string>",
"value": "<string>"
}
],
"variant": "<string>",
"product": "<string>"
}Headers
Body
application/json
Response
200 - application/json
Default Response