Create a new subscription (blockchain or snag)
curl --request POST \
--url https://admin.snagsolutions.io/api/stratus/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"websiteId": "<string>",
"organizationId": "<string>",
"functionIds": [
"<string>"
],
"callbackUrl": "https://admin.snagsolutions.io/api/webhook/subscription",
"metadata": null,
"startsAt": "<string>",
"endsAt": "<string>",
"maxEventsPerDay": 123,
"blockchainSubscriptions": [
{
"chainId": 123,
"contractAddress": "<string>",
"triggerId": "<string>",
"eventAbi": "<string>",
"functionAbi": "<string>",
"fromBlock": "<string>"
}
],
"snagSubscriptions": [
{
"tableNames": [
"<string>"
],
"triggerId": "<string>",
"mainLoyaltyAccountIds": [
"<string>"
]
}
]
}
'import requests
url = "https://admin.snagsolutions.io/api/stratus/subscriptions"
payload = {
"name": "<string>",
"websiteId": "<string>",
"organizationId": "<string>",
"functionIds": ["<string>"],
"callbackUrl": "https://admin.snagsolutions.io/api/webhook/subscription",
"metadata": None,
"startsAt": "<string>",
"endsAt": "<string>",
"maxEventsPerDay": 123,
"blockchainSubscriptions": [
{
"chainId": 123,
"contractAddress": "<string>",
"triggerId": "<string>",
"eventAbi": "<string>",
"functionAbi": "<string>",
"fromBlock": "<string>"
}
],
"snagSubscriptions": [
{
"tableNames": ["<string>"],
"triggerId": "<string>",
"mainLoyaltyAccountIds": ["<string>"]
}
]
}
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({
name: '<string>',
websiteId: '<string>',
organizationId: '<string>',
functionIds: ['<string>'],
callbackUrl: 'https://admin.snagsolutions.io/api/webhook/subscription',
metadata: null,
startsAt: '<string>',
endsAt: '<string>',
maxEventsPerDay: 123,
blockchainSubscriptions: [
{
chainId: 123,
contractAddress: '<string>',
triggerId: '<string>',
eventAbi: '<string>',
functionAbi: '<string>',
fromBlock: '<string>'
}
],
snagSubscriptions: [
{
tableNames: ['<string>'],
triggerId: '<string>',
mainLoyaltyAccountIds: ['<string>']
}
]
})
};
fetch('https://admin.snagsolutions.io/api/stratus/subscriptions', 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://admin.snagsolutions.io/api/stratus/subscriptions",
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([
'name' => '<string>',
'websiteId' => '<string>',
'organizationId' => '<string>',
'functionIds' => [
'<string>'
],
'callbackUrl' => 'https://admin.snagsolutions.io/api/webhook/subscription',
'metadata' => null,
'startsAt' => '<string>',
'endsAt' => '<string>',
'maxEventsPerDay' => 123,
'blockchainSubscriptions' => [
[
'chainId' => 123,
'contractAddress' => '<string>',
'triggerId' => '<string>',
'eventAbi' => '<string>',
'functionAbi' => '<string>',
'fromBlock' => '<string>'
]
],
'snagSubscriptions' => [
[
'tableNames' => [
'<string>'
],
'triggerId' => '<string>',
'mainLoyaltyAccountIds' => [
'<string>'
]
]
]
]),
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://admin.snagsolutions.io/api/stratus/subscriptions"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"websiteId\": \"<string>\",\n \"organizationId\": \"<string>\",\n \"functionIds\": [\n \"<string>\"\n ],\n \"callbackUrl\": \"https://admin.snagsolutions.io/api/webhook/subscription\",\n \"metadata\": null,\n \"startsAt\": \"<string>\",\n \"endsAt\": \"<string>\",\n \"maxEventsPerDay\": 123,\n \"blockchainSubscriptions\": [\n {\n \"chainId\": 123,\n \"contractAddress\": \"<string>\",\n \"triggerId\": \"<string>\",\n \"eventAbi\": \"<string>\",\n \"functionAbi\": \"<string>\",\n \"fromBlock\": \"<string>\"\n }\n ],\n \"snagSubscriptions\": [\n {\n \"tableNames\": [\n \"<string>\"\n ],\n \"triggerId\": \"<string>\",\n \"mainLoyaltyAccountIds\": [\n \"<string>\"\n ]\n }\n ]\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://admin.snagsolutions.io/api/stratus/subscriptions")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"websiteId\": \"<string>\",\n \"organizationId\": \"<string>\",\n \"functionIds\": [\n \"<string>\"\n ],\n \"callbackUrl\": \"https://admin.snagsolutions.io/api/webhook/subscription\",\n \"metadata\": null,\n \"startsAt\": \"<string>\",\n \"endsAt\": \"<string>\",\n \"maxEventsPerDay\": 123,\n \"blockchainSubscriptions\": [\n {\n \"chainId\": 123,\n \"contractAddress\": \"<string>\",\n \"triggerId\": \"<string>\",\n \"eventAbi\": \"<string>\",\n \"functionAbi\": \"<string>\",\n \"fromBlock\": \"<string>\"\n }\n ],\n \"snagSubscriptions\": [\n {\n \"tableNames\": [\n \"<string>\"\n ],\n \"triggerId\": \"<string>\",\n \"mainLoyaltyAccountIds\": [\n \"<string>\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.snagsolutions.io/api/stratus/subscriptions")
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 \"name\": \"<string>\",\n \"websiteId\": \"<string>\",\n \"organizationId\": \"<string>\",\n \"functionIds\": [\n \"<string>\"\n ],\n \"callbackUrl\": \"https://admin.snagsolutions.io/api/webhook/subscription\",\n \"metadata\": null,\n \"startsAt\": \"<string>\",\n \"endsAt\": \"<string>\",\n \"maxEventsPerDay\": 123,\n \"blockchainSubscriptions\": [\n {\n \"chainId\": 123,\n \"contractAddress\": \"<string>\",\n \"triggerId\": \"<string>\",\n \"eventAbi\": \"<string>\",\n \"functionAbi\": \"<string>\",\n \"fromBlock\": \"<string>\"\n }\n ],\n \"snagSubscriptions\": [\n {\n \"tableNames\": [\n \"<string>\"\n ],\n \"triggerId\": \"<string>\",\n \"mainLoyaltyAccountIds\": [\n \"<string>\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"websiteId": "<string>",
"organizationId": "<string>",
"callbackUrl": "<string>",
"id": "<string>",
"signingKey": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"functionIds": [
"<string>"
],
"metadata": null,
"startsAt": "<string>",
"endsAt": "<string>",
"version": "v1",
"disabled": true,
"disabledAt": "2023-11-07T05:31:56Z",
"disabledReason": "<string>",
"consecutiveFailures": 123,
"blockchainSubscriptions": [
{
"id": "<string>",
"chainId": 123,
"contractAddress": "<string>",
"blockchainSubscriptionType": "EVENT",
"eventSelector": "<string>",
"eventAbi": "<string>",
"functionAbi": "<string>",
"fromBlock": "<string>",
"createdAtBlock": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
}
],
"snagSubscriptions": [
{
"id": "<string>",
"table": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": "<string>"
}{
"name": "<string>",
"websiteId": "<string>",
"organizationId": "<string>",
"callbackUrl": "<string>",
"id": "<string>",
"signingKey": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"functionIds": [
"<string>"
],
"metadata": null,
"startsAt": "<string>",
"endsAt": "<string>",
"version": "v1",
"disabled": true,
"disabledAt": "2023-11-07T05:31:56Z",
"disabledReason": "<string>",
"consecutiveFailures": 123,
"blockchainSubscriptions": [
{
"id": "<string>",
"chainId": 123,
"contractAddress": "<string>",
"blockchainSubscriptionType": "EVENT",
"eventSelector": "<string>",
"eventAbi": "<string>",
"functionAbi": "<string>",
"fromBlock": "<string>",
"createdAtBlock": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
}
],
"snagSubscriptions": [
{
"id": "<string>",
"table": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}Stratus
Create a new subscription (blockchain or snag)
POST
/
api
/
stratus
/
subscriptions
Create a new subscription (blockchain or snag)
curl --request POST \
--url https://admin.snagsolutions.io/api/stratus/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"websiteId": "<string>",
"organizationId": "<string>",
"functionIds": [
"<string>"
],
"callbackUrl": "https://admin.snagsolutions.io/api/webhook/subscription",
"metadata": null,
"startsAt": "<string>",
"endsAt": "<string>",
"maxEventsPerDay": 123,
"blockchainSubscriptions": [
{
"chainId": 123,
"contractAddress": "<string>",
"triggerId": "<string>",
"eventAbi": "<string>",
"functionAbi": "<string>",
"fromBlock": "<string>"
}
],
"snagSubscriptions": [
{
"tableNames": [
"<string>"
],
"triggerId": "<string>",
"mainLoyaltyAccountIds": [
"<string>"
]
}
]
}
'import requests
url = "https://admin.snagsolutions.io/api/stratus/subscriptions"
payload = {
"name": "<string>",
"websiteId": "<string>",
"organizationId": "<string>",
"functionIds": ["<string>"],
"callbackUrl": "https://admin.snagsolutions.io/api/webhook/subscription",
"metadata": None,
"startsAt": "<string>",
"endsAt": "<string>",
"maxEventsPerDay": 123,
"blockchainSubscriptions": [
{
"chainId": 123,
"contractAddress": "<string>",
"triggerId": "<string>",
"eventAbi": "<string>",
"functionAbi": "<string>",
"fromBlock": "<string>"
}
],
"snagSubscriptions": [
{
"tableNames": ["<string>"],
"triggerId": "<string>",
"mainLoyaltyAccountIds": ["<string>"]
}
]
}
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({
name: '<string>',
websiteId: '<string>',
organizationId: '<string>',
functionIds: ['<string>'],
callbackUrl: 'https://admin.snagsolutions.io/api/webhook/subscription',
metadata: null,
startsAt: '<string>',
endsAt: '<string>',
maxEventsPerDay: 123,
blockchainSubscriptions: [
{
chainId: 123,
contractAddress: '<string>',
triggerId: '<string>',
eventAbi: '<string>',
functionAbi: '<string>',
fromBlock: '<string>'
}
],
snagSubscriptions: [
{
tableNames: ['<string>'],
triggerId: '<string>',
mainLoyaltyAccountIds: ['<string>']
}
]
})
};
fetch('https://admin.snagsolutions.io/api/stratus/subscriptions', 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://admin.snagsolutions.io/api/stratus/subscriptions",
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([
'name' => '<string>',
'websiteId' => '<string>',
'organizationId' => '<string>',
'functionIds' => [
'<string>'
],
'callbackUrl' => 'https://admin.snagsolutions.io/api/webhook/subscription',
'metadata' => null,
'startsAt' => '<string>',
'endsAt' => '<string>',
'maxEventsPerDay' => 123,
'blockchainSubscriptions' => [
[
'chainId' => 123,
'contractAddress' => '<string>',
'triggerId' => '<string>',
'eventAbi' => '<string>',
'functionAbi' => '<string>',
'fromBlock' => '<string>'
]
],
'snagSubscriptions' => [
[
'tableNames' => [
'<string>'
],
'triggerId' => '<string>',
'mainLoyaltyAccountIds' => [
'<string>'
]
]
]
]),
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://admin.snagsolutions.io/api/stratus/subscriptions"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"websiteId\": \"<string>\",\n \"organizationId\": \"<string>\",\n \"functionIds\": [\n \"<string>\"\n ],\n \"callbackUrl\": \"https://admin.snagsolutions.io/api/webhook/subscription\",\n \"metadata\": null,\n \"startsAt\": \"<string>\",\n \"endsAt\": \"<string>\",\n \"maxEventsPerDay\": 123,\n \"blockchainSubscriptions\": [\n {\n \"chainId\": 123,\n \"contractAddress\": \"<string>\",\n \"triggerId\": \"<string>\",\n \"eventAbi\": \"<string>\",\n \"functionAbi\": \"<string>\",\n \"fromBlock\": \"<string>\"\n }\n ],\n \"snagSubscriptions\": [\n {\n \"tableNames\": [\n \"<string>\"\n ],\n \"triggerId\": \"<string>\",\n \"mainLoyaltyAccountIds\": [\n \"<string>\"\n ]\n }\n ]\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://admin.snagsolutions.io/api/stratus/subscriptions")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"websiteId\": \"<string>\",\n \"organizationId\": \"<string>\",\n \"functionIds\": [\n \"<string>\"\n ],\n \"callbackUrl\": \"https://admin.snagsolutions.io/api/webhook/subscription\",\n \"metadata\": null,\n \"startsAt\": \"<string>\",\n \"endsAt\": \"<string>\",\n \"maxEventsPerDay\": 123,\n \"blockchainSubscriptions\": [\n {\n \"chainId\": 123,\n \"contractAddress\": \"<string>\",\n \"triggerId\": \"<string>\",\n \"eventAbi\": \"<string>\",\n \"functionAbi\": \"<string>\",\n \"fromBlock\": \"<string>\"\n }\n ],\n \"snagSubscriptions\": [\n {\n \"tableNames\": [\n \"<string>\"\n ],\n \"triggerId\": \"<string>\",\n \"mainLoyaltyAccountIds\": [\n \"<string>\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.snagsolutions.io/api/stratus/subscriptions")
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 \"name\": \"<string>\",\n \"websiteId\": \"<string>\",\n \"organizationId\": \"<string>\",\n \"functionIds\": [\n \"<string>\"\n ],\n \"callbackUrl\": \"https://admin.snagsolutions.io/api/webhook/subscription\",\n \"metadata\": null,\n \"startsAt\": \"<string>\",\n \"endsAt\": \"<string>\",\n \"maxEventsPerDay\": 123,\n \"blockchainSubscriptions\": [\n {\n \"chainId\": 123,\n \"contractAddress\": \"<string>\",\n \"triggerId\": \"<string>\",\n \"eventAbi\": \"<string>\",\n \"functionAbi\": \"<string>\",\n \"fromBlock\": \"<string>\"\n }\n ],\n \"snagSubscriptions\": [\n {\n \"tableNames\": [\n \"<string>\"\n ],\n \"triggerId\": \"<string>\",\n \"mainLoyaltyAccountIds\": [\n \"<string>\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"websiteId": "<string>",
"organizationId": "<string>",
"callbackUrl": "<string>",
"id": "<string>",
"signingKey": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"functionIds": [
"<string>"
],
"metadata": null,
"startsAt": "<string>",
"endsAt": "<string>",
"version": "v1",
"disabled": true,
"disabledAt": "2023-11-07T05:31:56Z",
"disabledReason": "<string>",
"consecutiveFailures": 123,
"blockchainSubscriptions": [
{
"id": "<string>",
"chainId": 123,
"contractAddress": "<string>",
"blockchainSubscriptionType": "EVENT",
"eventSelector": "<string>",
"eventAbi": "<string>",
"functionAbi": "<string>",
"fromBlock": "<string>",
"createdAtBlock": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
}
],
"snagSubscriptions": [
{
"id": "<string>",
"table": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": "<string>"
}{
"name": "<string>",
"websiteId": "<string>",
"organizationId": "<string>",
"callbackUrl": "<string>",
"id": "<string>",
"signingKey": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"functionIds": [
"<string>"
],
"metadata": null,
"startsAt": "<string>",
"endsAt": "<string>",
"version": "v1",
"disabled": true,
"disabledAt": "2023-11-07T05:31:56Z",
"disabledReason": "<string>",
"consecutiveFailures": 123,
"blockchainSubscriptions": [
{
"id": "<string>",
"chainId": 123,
"contractAddress": "<string>",
"blockchainSubscriptionType": "EVENT",
"eventSelector": "<string>",
"eventAbi": "<string>",
"functionAbi": "<string>",
"fromBlock": "<string>",
"createdAtBlock": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
}
],
"snagSubscriptions": [
{
"id": "<string>",
"table": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Body
application/json
Body
Maximum string length:
1000Must be the one below!!
Example:
"https://admin.snagsolutions.io/api/webhook/subscription"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
200
Available options:
v1, v2 Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?