Skip to main content
GET
/
api
/
external
/
v2
/
product-swaps
/
{id}
Get a specific product swap by ID
curl --request GET \
  --url https://subscription-admin.appstle.com/api/external/v2/product-swaps/{id}
import requests

url = "https://subscription-admin.appstle.com/api/external/v2/product-swaps/{id}"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://subscription-admin.appstle.com/api/external/v2/product-swaps/{id}', 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/product-swaps/{id}';
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/product-swaps/{id}",
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/product-swaps/{id}"

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/product-swaps/{id}")

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
{
  "active": true,
  "carryDiscountForward": true,
  "checkForEveryRecurringOrder": false,
  "contractsAffected": 145,
  "createdAt": "2024-01-15T10:30:00Z",
  "description": "Automatically swap to seasonal blend at cycle 4",
  "destinationVariants": "[{\"id\":67890,\"displayName\":\"Fall Blend Coffee - 12oz\",\"imageSrc\":\"https://cdn.shopify.com/files/1/0000/0000/products/fall-blend.jpg\",\"quantity\":2,\"price\":\"29.99\"}]",
  "discountCarryForward": "PERCENTAGE",
  "forBillingCycle": 4,
  "id": 10782,
  "name": "Seasonal Coffee Rotation",
  "shop": "example-shop.myshopify.com",
  "sourceVariants": "[{\"id\":12345,\"displayName\":\"Summer Blend Coffee - 12oz\",\"imageSrc\":\"https://cdn.shopify.com/files/1/0000/0000/products/summer-blend.jpg\",\"quantity\":2,\"price\":\"29.99\"}]",
  "stopSwapEmails": false,
  "updatedAt": "2024-01-15T10:30:00Z",
  "updatedFirstOrder": false
}
{
"detail": "Product swap does not belong to this shop",
"status": 400,
"title": "Invalid id",
"type": "https://example.com/errors/bad-request"
}
{
"detail": "Valid X-API-Key header is required",
"status": 401,
"title": "Authentication required",
"type": "https://example.com/errors/unauthorized"
}
{
"detail": "API key does not have permission to view product swaps",
"status": 403,
"title": "Insufficient permissions",
"type": "https://example.com/errors/forbidden"
}
{
"detail": "Product swap with ID 10782 not found",
"status": 404,
"title": "Resource not found",
"type": "https://example.com/errors/not-found"
}

Headers

X-API-Key
string

Path Parameters

id
integer<int64>
required

Response

Product swap successfully retrieved

shop
string
required
carryDiscountForward
boolean
changeNextOrderDateBy
integer<int32>
checkForEveryRecurringOrder
boolean
destinationVariants
string
discountCarryForward
enum<string>
Available options:
NONE,
EXISTING_PLAN,
PRODUCT_PLAN,
PRODUCT_THEN_EXISTING
forBillingCycle
integer<int32>
id
integer<int64>
name
string
ruleSequence
integer<int32>
sourceVariants
string
stopSwapEmails
boolean
updatedFirstOrder
boolean