curl --request POST \
--url https://api.scrip.dev/v1/rules/{id}/move \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"expected_rule_configuration_version": 3,
"position": {
"placement": "before",
"reference_id": "550e8400-e29b-41d4-a716-446655440000"
},
"rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.scrip.dev/v1/rules/{id}/move"
payload = {
"expected_rule_configuration_version": 3,
"position": {
"placement": "before",
"reference_id": "550e8400-e29b-41d4-a716-446655440000"
},
"rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
expected_rule_configuration_version: 3,
position: {placement: 'before', reference_id: '550e8400-e29b-41d4-a716-446655440000'},
rule_set_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.scrip.dev/v1/rules/{id}/move', 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.scrip.dev/v1/rules/{id}/move",
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([
'expected_rule_configuration_version' => 3,
'position' => [
'placement' => 'before',
'reference_id' => '550e8400-e29b-41d4-a716-446655440000'
],
'rule_set_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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.scrip.dev/v1/rules/{id}/move"
payload := strings.NewReader("{\n \"expected_rule_configuration_version\": 3,\n \"position\": {\n \"placement\": \"before\",\n \"reference_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n \"rule_set_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.scrip.dev/v1/rules/{id}/move")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expected_rule_configuration_version\": 3,\n \"position\": {\n \"placement\": \"before\",\n \"reference_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n \"rule_set_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/rules/{id}/move")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expected_rule_configuration_version\": 3,\n \"position\": {\n \"placement\": \"before\",\n \"reference_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n \"rule_set_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"destination_rules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"order": 123,
"rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "ACTIVE"
}
],
"rule": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"order": 123,
"rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "ACTIVE"
},
"rule_configuration_version": 4,
"source_rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source_rules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"order": 123,
"rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "ACTIVE"
}
]
}{
"code": "bad_request",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Invalid request parameters"
}{
"code": "unauthorized",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Missing or invalid credentials"
}{
"code": "forbidden",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Insufficient permissions for this action"
}{
"code": "not_found",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Resource not found"
}{
"code": "rule_configuration_version_conflict",
"details": {
"current_rule_configuration_version": 4,
"expected_rule_configuration_version": 3,
"instruction": "Refetch the rule configuration and replan the mutation."
},
"message": "Rule configuration changed since this mutation was planned"
}{
"code": "unprocessable",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Business rule violation"
}{
"code": "internal_error",
"message": "An internal error occurred"
}Move a rule
Move one ACTIVE or SUSPENDED rule to first/last or before/after a rule in the destination set from the supplied expected_rule_configuration_version. Source and destination positions are atomically renumbered to 1..N.
curl --request POST \
--url https://api.scrip.dev/v1/rules/{id}/move \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"expected_rule_configuration_version": 3,
"position": {
"placement": "before",
"reference_id": "550e8400-e29b-41d4-a716-446655440000"
},
"rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.scrip.dev/v1/rules/{id}/move"
payload = {
"expected_rule_configuration_version": 3,
"position": {
"placement": "before",
"reference_id": "550e8400-e29b-41d4-a716-446655440000"
},
"rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
expected_rule_configuration_version: 3,
position: {placement: 'before', reference_id: '550e8400-e29b-41d4-a716-446655440000'},
rule_set_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.scrip.dev/v1/rules/{id}/move', 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.scrip.dev/v1/rules/{id}/move",
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([
'expected_rule_configuration_version' => 3,
'position' => [
'placement' => 'before',
'reference_id' => '550e8400-e29b-41d4-a716-446655440000'
],
'rule_set_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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.scrip.dev/v1/rules/{id}/move"
payload := strings.NewReader("{\n \"expected_rule_configuration_version\": 3,\n \"position\": {\n \"placement\": \"before\",\n \"reference_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n \"rule_set_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.scrip.dev/v1/rules/{id}/move")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expected_rule_configuration_version\": 3,\n \"position\": {\n \"placement\": \"before\",\n \"reference_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n \"rule_set_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/rules/{id}/move")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expected_rule_configuration_version\": 3,\n \"position\": {\n \"placement\": \"before\",\n \"reference_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n \"rule_set_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"destination_rules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"order": 123,
"rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "ACTIVE"
}
],
"rule": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"order": 123,
"rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "ACTIVE"
},
"rule_configuration_version": 4,
"source_rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source_rules": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"order": 123,
"rule_set_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "ACTIVE"
}
]
}{
"code": "bad_request",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Invalid request parameters"
}{
"code": "unauthorized",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Missing or invalid credentials"
}{
"code": "forbidden",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Insufficient permissions for this action"
}{
"code": "not_found",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Resource not found"
}{
"code": "rule_configuration_version_conflict",
"details": {
"current_rule_configuration_version": 4,
"expected_rule_configuration_version": 3,
"instruction": "Refetch the rule configuration and replan the mutation."
},
"message": "Rule configuration changed since this mutation was planned"
}{
"code": "unprocessable",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Business rule violation"
}{
"code": "internal_error",
"message": "An internal error occurred"
}ACTIVE or SUSPENDED rule within its current set or into another set. Supply the destination rule_set_id, a semantic position, and the current expected_rule_configuration_version.
Scrip renumbers the source and destination sequences in one transaction. Archived rules cannot move.Authorizations
API key passed in the X-API-Key header.
Path Parameters
Rule ID
Body
Destination rule set and semantic position
Current rule_configuration_version from the configuration read endpoint. A stale value rejects the request.
x >= 13
Semantic destination within the destination rule set.
- Option 1
- Option 2
Show child attributes
Show child attributes
Destination rule-set ID. It may be the rule's current set.
Response
OK
Complete renumbered sequence in the destination set.
Show child attributes
Show child attributes
Moved rule in its final position.
Show child attributes
Show child attributes
Resulting program rule-configuration version.
4
Rule set that contained the rule before the move.
Complete renumbered sequence left in the source set.
Show child attributes
Show child attributes