Rulesets
Create ruleset
Creates a new DRAFT ruleset. Version is assigned automatically. Lifecycle: DRAFT → ACTIVE.
POST
/
api
/
admin
/
rulesets
Create ruleset
curl --request POST \
--url https://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"context": "checkout",
"created_by": "ops@example.com",
"description": "Standard checkout rules",
"rules": [
{
"id": "r1",
"async": true,
"backend": "vdm",
"condition": {},
"description": "<string>",
"enabled": true,
"name": "Block USD"
}
]
}
'import requests
url = "https://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets"
payload = {
"context": "checkout",
"created_by": "ops@example.com",
"description": "Standard checkout rules",
"rules": [
{
"id": "r1",
"async": True,
"backend": "vdm",
"condition": {},
"description": "<string>",
"enabled": True,
"name": "Block USD"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
context: 'checkout',
created_by: 'ops@example.com',
description: 'Standard checkout rules',
rules: [
{
id: 'r1',
async: true,
backend: 'vdm',
condition: {},
description: '<string>',
enabled: true,
name: 'Block USD'
}
]
})
};
fetch('https://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets', 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://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets",
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([
'context' => 'checkout',
'created_by' => 'ops@example.com',
'description' => 'Standard checkout rules',
'rules' => [
[
'id' => 'r1',
'async' => true,
'backend' => 'vdm',
'condition' => [
],
'description' => '<string>',
'enabled' => true,
'name' => 'Block USD'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets"
payload := strings.NewReader("{\n \"context\": \"checkout\",\n \"created_by\": \"ops@example.com\",\n \"description\": \"Standard checkout rules\",\n \"rules\": [\n {\n \"id\": \"r1\",\n \"async\": true,\n \"backend\": \"vdm\",\n \"condition\": {},\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"Block USD\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"context\": \"checkout\",\n \"created_by\": \"ops@example.com\",\n \"description\": \"Standard checkout rules\",\n \"rules\": [\n {\n \"id\": \"r1\",\n \"async\": true,\n \"backend\": \"vdm\",\n \"condition\": {},\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"Block USD\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"context\": \"checkout\",\n \"created_by\": \"ops@example.com\",\n \"description\": \"Standard checkout rules\",\n \"rules\": [\n {\n \"id\": \"r1\",\n \"async\": true,\n \"backend\": \"vdm\",\n \"condition\": {},\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"Block USD\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"activated_at": "2023-11-07T05:31:56Z",
"context": "checkout",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"rules": [
{
"enabled": true,
"id": "r1",
"async": true,
"backend": "vdm",
"condition": {},
"description": "<string>",
"fields": [
"<string>"
],
"live": true,
"members": [
{
"backend": "vdm",
"live": true,
"weight": 60
}
],
"name": "Block USD",
"populate_on": [],
"ttl_seconds": 123
}
],
"version": 1
}{
"classifier": "NOT_FOUND",
"code": 404,
"message": "The requested resource does not exist"
}{
"classifier": "NOT_FOUND",
"code": 404,
"message": "The requested resource does not exist"
}{
"classifier": "VALIDATION_ERROR",
"code": 422,
"validation_errors": [
{
"message": "must be a positive integer",
"path": "limit"
}
]
}Authorizations
HS256-signed JWT bearer token, obtained via the OAuth2 client-credentials grant (see Authentication).
Body
application/json
Ruleset attributes
Response
Created ruleset
Example:
"checkout"
Rule definitions evaluated in array order
Show child attributes
Show child attributes
Available options:
DRAFT, ACTIVE, INACTIVE Example:
1
Previous
Get rulesetsLists rulesets across all states (DRAFT, ACTIVE, INACTIVE). Supports pagination.
Next
⌘I
Create ruleset
curl --request POST \
--url https://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"context": "checkout",
"created_by": "ops@example.com",
"description": "Standard checkout rules",
"rules": [
{
"id": "r1",
"async": true,
"backend": "vdm",
"condition": {},
"description": "<string>",
"enabled": true,
"name": "Block USD"
}
]
}
'import requests
url = "https://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets"
payload = {
"context": "checkout",
"created_by": "ops@example.com",
"description": "Standard checkout rules",
"rules": [
{
"id": "r1",
"async": True,
"backend": "vdm",
"condition": {},
"description": "<string>",
"enabled": True,
"name": "Block USD"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
context: 'checkout',
created_by: 'ops@example.com',
description: 'Standard checkout rules',
rules: [
{
id: 'r1',
async: true,
backend: 'vdm',
condition: {},
description: '<string>',
enabled: true,
name: 'Block USD'
}
]
})
};
fetch('https://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets', 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://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets",
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([
'context' => 'checkout',
'created_by' => 'ops@example.com',
'description' => 'Standard checkout rules',
'rules' => [
[
'id' => 'r1',
'async' => true,
'backend' => 'vdm',
'condition' => [
],
'description' => '<string>',
'enabled' => true,
'name' => 'Block USD'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets"
payload := strings.NewReader("{\n \"context\": \"checkout\",\n \"created_by\": \"ops@example.com\",\n \"description\": \"Standard checkout rules\",\n \"rules\": [\n {\n \"id\": \"r1\",\n \"async\": true,\n \"backend\": \"vdm\",\n \"condition\": {},\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"Block USD\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"context\": \"checkout\",\n \"created_by\": \"ops@example.com\",\n \"description\": \"Standard checkout rules\",\n \"rules\": [\n {\n \"id\": \"r1\",\n \"async\": true,\n \"backend\": \"vdm\",\n \"condition\": {},\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"Block USD\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.{env}.on-hellgate.cloud/api/admin/rulesets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"context\": \"checkout\",\n \"created_by\": \"ops@example.com\",\n \"description\": \"Standard checkout rules\",\n \"rules\": [\n {\n \"id\": \"r1\",\n \"async\": true,\n \"backend\": \"vdm\",\n \"condition\": {},\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"Block USD\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"activated_at": "2023-11-07T05:31:56Z",
"context": "checkout",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"rules": [
{
"enabled": true,
"id": "r1",
"async": true,
"backend": "vdm",
"condition": {},
"description": "<string>",
"fields": [
"<string>"
],
"live": true,
"members": [
{
"backend": "vdm",
"live": true,
"weight": 60
}
],
"name": "Block USD",
"populate_on": [],
"ttl_seconds": 123
}
],
"version": 1
}{
"classifier": "NOT_FOUND",
"code": 404,
"message": "The requested resource does not exist"
}{
"classifier": "NOT_FOUND",
"code": 404,
"message": "The requested resource does not exist"
}{
"classifier": "VALIDATION_ERROR",
"code": 422,
"validation_errors": [
{
"message": "must be a positive integer",
"path": "limit"
}
]
}