Reconstruct rule configuration as of a timestamp
curl --request GET \
--url https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of', 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/programs/{programId}/rule-configuration/revisions/as-of",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"caveats": [
{
"code": "history_not_yet_tracked",
"message": "<string>"
}
],
"revision": {
"actor": {
"actor_source": "direct_user",
"api_key_id": "<string>",
"external_subject": "<string>",
"external_subject_type": "<string>",
"rule_id": "<string>",
"user_id": "<string>",
"via_api_key_id": "<string>"
},
"affected_rule_ids": [
"<string>"
],
"affected_rule_set_ids": [
"<string>"
],
"changed_at": "2023-11-07T05:31:56Z",
"configuration": {
"program_id": "<string>",
"rule_configuration_version": 123,
"rule_sets": [
{
"id": "<string>",
"key": "<string>",
"name": "<string>",
"order": 123,
"rules": [
{
"actions": [
{
"amount": "${{ event.amount * 0.03 }}",
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"description": "Purchase reward",
"expires_at": "365d",
"matures_at": "30d",
"type": "CREDIT"
}
],
"active_from": "2023-11-07T05:31:56Z",
"active_to": "2023-11-07T05:31:56Z",
"budgets": [
{
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"limit": "10000.00"
}
],
"client_ref": "<string>",
"condition": "<string>",
"description": "<string>",
"id": "<string>",
"name": "<string>",
"order": 123,
"rule_set_id": "<string>",
"status": "<string>",
"stop_after_match": true
}
]
}
]
},
"configuration_change_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"diff": {
"rule_sets": [
{
"after": "<unknown>",
"before": "<unknown>",
"change_type": "create",
"client_ref": "<string>",
"fields": [
"<string>"
],
"id": "<string>"
}
],
"rules": [
{
"after": "<unknown>",
"before": "<unknown>",
"change_type": "create",
"client_ref": "<string>",
"fields": [
"<string>"
],
"id": "<string>"
}
]
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"program_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rule_configuration_version": 123,
"rule_history_ids": [
"<string>"
],
"rule_set_history_ids": [
"<string>"
],
"source": {
"reference": "<string>",
"source_revision": 123,
"type": "<string>"
},
"source_revision": 123
}
}{
"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": "internal_error",
"message": "An internal error occurred"
}Rule configuration
Get rule configuration as of a timestamp
Return the last immutable configuration revision at or before the RFC3339 timestamp. The revision field is omitted and explicit caveats are returned when the time predates tracked history.
GET
/
v1
/
programs
/
{programId}
/
rule-configuration
/
revisions
/
as-of
Reconstruct rule configuration as of a timestamp
curl --request GET \
--url https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of', 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/programs/{programId}/rule-configuration/revisions/as-of",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/as-of")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"caveats": [
{
"code": "history_not_yet_tracked",
"message": "<string>"
}
],
"revision": {
"actor": {
"actor_source": "direct_user",
"api_key_id": "<string>",
"external_subject": "<string>",
"external_subject_type": "<string>",
"rule_id": "<string>",
"user_id": "<string>",
"via_api_key_id": "<string>"
},
"affected_rule_ids": [
"<string>"
],
"affected_rule_set_ids": [
"<string>"
],
"changed_at": "2023-11-07T05:31:56Z",
"configuration": {
"program_id": "<string>",
"rule_configuration_version": 123,
"rule_sets": [
{
"id": "<string>",
"key": "<string>",
"name": "<string>",
"order": 123,
"rules": [
{
"actions": [
{
"amount": "${{ event.amount * 0.03 }}",
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"description": "Purchase reward",
"expires_at": "365d",
"matures_at": "30d",
"type": "CREDIT"
}
],
"active_from": "2023-11-07T05:31:56Z",
"active_to": "2023-11-07T05:31:56Z",
"budgets": [
{
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"limit": "10000.00"
}
],
"client_ref": "<string>",
"condition": "<string>",
"description": "<string>",
"id": "<string>",
"name": "<string>",
"order": 123,
"rule_set_id": "<string>",
"status": "<string>",
"stop_after_match": true
}
]
}
]
},
"configuration_change_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"diff": {
"rule_sets": [
{
"after": "<unknown>",
"before": "<unknown>",
"change_type": "create",
"client_ref": "<string>",
"fields": [
"<string>"
],
"id": "<string>"
}
],
"rules": [
{
"after": "<unknown>",
"before": "<unknown>",
"change_type": "create",
"client_ref": "<string>",
"fields": [
"<string>"
],
"id": "<string>"
}
]
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"program_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rule_configuration_version": 123,
"rule_history_ids": [
"<string>"
],
"rule_set_history_ids": [
"<string>"
],
"source": {
"reference": "<string>",
"source_revision": 123,
"type": "<string>"
},
"source_revision": 123
}
}{
"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": "internal_error",
"message": "An internal error occurred"
}Returns the latest tracked immutable revision at or before the RFC 3339
at timestamp.
When the timestamp predates tracked history, the response omits revision and returns an explicit caveats entry.Authorizations
ApiKeyAuthBearerAuth
API key passed in the X-API-Key header.
Path Parameters
Program ID
Query Parameters
RFC3339 as-of timestamp
⌘I