curl --request PATCH \
--url https://api.creem.io/v1/product-groups/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"external_id": "pro-plans",
"products": [
{
"id": "prod_4dGTkmBdnTnU9vV3KZ2Hcz"
}
],
"upgrades_enabled": true,
"upsells_enabled": true,
"is_active": true
}
'import requests
url = "https://api.creem.io/v1/product-groups/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"external_id": "pro-plans",
"products": [{ "id": "prod_4dGTkmBdnTnU9vV3KZ2Hcz" }],
"upgrades_enabled": True,
"upsells_enabled": True,
"is_active": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
external_id: 'pro-plans',
products: [{id: 'prod_4dGTkmBdnTnU9vV3KZ2Hcz'}],
upgrades_enabled: true,
upsells_enabled: true,
is_active: true
})
};
fetch('https://api.creem.io/v1/product-groups/{id}', 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.creem.io/v1/product-groups/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'external_id' => 'pro-plans',
'products' => [
[
'id' => 'prod_4dGTkmBdnTnU9vV3KZ2Hcz'
]
],
'upgrades_enabled' => true,
'upsells_enabled' => true,
'is_active' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://api.creem.io/v1/product-groups/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"pro-plans\",\n \"products\": [\n {\n \"id\": \"prod_4dGTkmBdnTnU9vV3KZ2Hcz\"\n }\n ],\n \"upgrades_enabled\": true,\n \"upsells_enabled\": true,\n \"is_active\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<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.patch("https://api.creem.io/v1/product-groups/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"pro-plans\",\n \"products\": [\n {\n \"id\": \"prod_4dGTkmBdnTnU9vV3KZ2Hcz\"\n }\n ],\n \"upgrades_enabled\": true,\n \"upsells_enabled\": true,\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.creem.io/v1/product-groups/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"pro-plans\",\n \"products\": [\n {\n \"id\": \"prod_4dGTkmBdnTnU9vV3KZ2Hcz\"\n }\n ],\n \"upgrades_enabled\": true,\n \"upsells_enabled\": true,\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"mode": "test",
"object": "product_group",
"name": "<string>",
"description": "<string>",
"external_id": "<string>",
"products": [
{
"id": "<string>",
"external_id": "<string>"
}
],
"upgrades_enabled": true,
"upgrade_behavior": "proration-charge-immediately",
"upsells_enabled": true,
"is_active": true,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z",
"write_result": {
"result": "updated",
"dry_run": false,
"changes": [
{
"path": "products",
"from": [
"prod_monthly",
"prod_yearly"
],
"to": [
"prod_yearly",
"prod_monthly"
]
}
],
"warnings": [
{
"code": "reference_not_found",
"path": "<string>",
"key": "<string>"
}
]
}
}Update a product group
Omitted fields stay unchanged. products, when sent, is the complete ordered member list: products it does not contain are removed, and its order is the display order. The request is compared with the stored group first: a request that changes nothing answers write_result.result unchanged and writes nothing, and an equal ordered member list writes no member. The product group comes back with write_result.
curl --request PATCH \
--url https://api.creem.io/v1/product-groups/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"external_id": "pro-plans",
"products": [
{
"id": "prod_4dGTkmBdnTnU9vV3KZ2Hcz"
}
],
"upgrades_enabled": true,
"upsells_enabled": true,
"is_active": true
}
'import requests
url = "https://api.creem.io/v1/product-groups/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"external_id": "pro-plans",
"products": [{ "id": "prod_4dGTkmBdnTnU9vV3KZ2Hcz" }],
"upgrades_enabled": True,
"upsells_enabled": True,
"is_active": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
external_id: 'pro-plans',
products: [{id: 'prod_4dGTkmBdnTnU9vV3KZ2Hcz'}],
upgrades_enabled: true,
upsells_enabled: true,
is_active: true
})
};
fetch('https://api.creem.io/v1/product-groups/{id}', 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.creem.io/v1/product-groups/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'external_id' => 'pro-plans',
'products' => [
[
'id' => 'prod_4dGTkmBdnTnU9vV3KZ2Hcz'
]
],
'upgrades_enabled' => true,
'upsells_enabled' => true,
'is_active' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://api.creem.io/v1/product-groups/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"pro-plans\",\n \"products\": [\n {\n \"id\": \"prod_4dGTkmBdnTnU9vV3KZ2Hcz\"\n }\n ],\n \"upgrades_enabled\": true,\n \"upsells_enabled\": true,\n \"is_active\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<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.patch("https://api.creem.io/v1/product-groups/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"pro-plans\",\n \"products\": [\n {\n \"id\": \"prod_4dGTkmBdnTnU9vV3KZ2Hcz\"\n }\n ],\n \"upgrades_enabled\": true,\n \"upsells_enabled\": true,\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.creem.io/v1/product-groups/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"external_id\": \"pro-plans\",\n \"products\": [\n {\n \"id\": \"prod_4dGTkmBdnTnU9vV3KZ2Hcz\"\n }\n ],\n \"upgrades_enabled\": true,\n \"upsells_enabled\": true,\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"mode": "test",
"object": "product_group",
"name": "<string>",
"description": "<string>",
"external_id": "<string>",
"products": [
{
"id": "<string>",
"external_id": "<string>"
}
],
"upgrades_enabled": true,
"upgrade_behavior": "proration-charge-immediately",
"upsells_enabled": true,
"is_active": true,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z",
"write_result": {
"result": "updated",
"dry_run": false,
"changes": [
{
"path": "products",
"from": [
"prod_monthly",
"prod_yearly"
],
"to": [
"prod_yearly",
"prod_monthly"
]
}
],
"warnings": [
{
"code": "reference_not_found",
"path": "<string>",
"key": "<string>"
}
]
}
}Authorizations
Query Parameters
Send true to preview the write: the request runs as it would and is rolled back, so nothing is written. The answer is the one the real call would give: the same status (201 for a create) and errors, and the product group with write_result.dry_run true. The id of a product group a dry run would create is never stored: a GET of it answers 404. A product id or external_id that names no product of the store is a reference_not_found warning (path, key) instead of a 400: on a create that entry is left out of the answer, and on an update the stored members stay as they are. false or no parameter is a real call; any other value answers 400.
Body
Your own key for this product group. Unique per store, case-sensitive; 1 to 255 characters: letters, digits, _, -, . and :. A key another group of your store uses answers 409 with code external_id_taken. Omit it to leave the key unchanged; send null to clear it.
"pro-plans"
Response
The updated product group