This page covers configuration and management of View collection objects.

Object Overview

Webhook rules dictate the conditions by which webhooks are invoked.

Endpoint, URL, and Supported Methods

Objects are managed via the Configuration server API at [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/webhookrules

Supported methods include: GET HEAD PUT DELETE

Structure

Objects have the following structure:

{
    "GUID": "b4cf5430-9c25-4514-b3e5-fe7fd1108edb",
    "TenantGUID": "00000000-0000-0000-0000-000000000000",
    "TargetGUID": "00000000-0000-0000-0000-000000000000",
    "Name": "My webhook rule",
    "EventType": "ObjectWrite",
    "MaxAttempts": 5,
    "RetryIntervalMs": 10000,
    "TimeoutMs": 30000,
    "CreatedUtc": "2025-03-29T09:23:23.035429Z"
}
  • GUID GUID globally unique identifier for the object
  • TenantGUID GUID globally unique identifier for the tenant
  • TargetGUID GUID globally unique identifier for the target
  • Name string name of the object
  • EventType string event type
  • MaxAttempts number number of max attempts for webhook
  • RetryIntervalMs number inter between attempts in ms
  • TimeoutMs number time out in ms
  • CreatedUtc datetime timestamp from creation, in UTC time

Create

To create, call PUT /v1.0/tenants/[tenant-guid]/webhookrules with the following properties using the Configuration server

curl --location --request PUT 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/webhookrules' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "Name": "My webhook rule",
    "TargetGUID": "00000000-0000-0000-0000-000000000000",
    "EventType": "ObjectWrite",
    "MaxAttempts": 5,
    "RetryIntervalMs": 10000,
    "TimeoutMs": 30000
}'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);


const createWebhookRules = async () => {
  try {
    const response = await api.createWebhookRule({
      Name: "My webhook rule",
      TargetGUID: "00000000-0000-0000-0000-000000000000",
      EventType: "ObjectWrite",
      MaxAttempts: 5,
      RetryIntervalMs: 10000,
      TimeoutMs: 30000,
    });
    console.log(response, "Webhook rules created successfully");
  } catch (err) {
    console.log("Error creating Webhook rules:", err);
  }
};

createWebhookRules();

Enumerate

Enumerate objects by using GET /v2.0/tenants/[tenant-guid]/webhookrules

curl --location 'http://view.homedns.org:8000/v2.0/tenants/00000000-0000-0000-0000-000000000000/webhookrules' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);


const enumerateWebhookRules = async () => {
  try {
    const response = await api.enumerateWebhookRules();
    console.log(response, "Webhook rules fetched successfully");
  } catch (err) {
    console.log("Error fetching Webhook rules:", err);
  }
};

enumerateWebhookRules();

Read

To read an object by GUID, call GET /v1.0/tenants/[tenant-guid]/webhookrules/[webhookrule-guid]. If the object exists, it will be returned as a JSON object in the response body. If it does not exist, a 404 will be returned with a NotFound error response.

curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/webhookrules/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);
const readWebhookRule = async () => {
  try {
    const response = await api.retrieveWebhookRule(
      "b4cf5430-9c25-4514-b3e5-fe7fd1108edb"
    );
    console.log(response, "Webhook rule fetched successfully");
  } catch (err) {
    console.log("Error fetching Webhook rule:", err);
  }
};

readWebhookRule();;

Read all

To read all objects, call GET /v1.0/tenants/[tenant-guid]/webhookrules/. If the object exists, it will be returned as an array of JSON object in the response body

curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/webhookrules' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const readAllWebhookRules = async () => {
  try {
    const response = await api.retrieveWebhookRules();
    console.log(response, "All webhook rules fetched successfully");
  } catch (err) {
    console.log("Error fetching All webhook rules:", err);
  }
};

readAllWebhookRules();

Update

To update, call PUT /v1.0/tenants/[tenant-guid]/webhookrules/{webhookrule-guid} with the object properties using the Configuration server

curl --location --request PUT 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/webhookrules/00000000-0000-0000-0000-000000000000' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "TargetGUID": "00000000-0000-0000-0000-000000000000",
    "Name": "My updated webhook rule",
    "EventType": "ObjectWrite",
    "MaxAttempts": 5,
    "RetryIntervalMs": 10000,
    "TimeoutMs": 30000
}'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const updateWebhookRule = async () => {
  try {
    const response = await api.updateWebhookRule({
      GUID: "59c7402c-dd30-4723-beba-3a3460f26bf7",
      TenantGUID: "00000000-0000-0000-0000-000000000000",
      TargetGUID: "00000000-0000-0000-0000-000000000000",
      Name: "My webhook rule [UPDATED]",
      EventType: "ObjectWrite",
      MaxAttempts: 5,
      RetryIntervalMs: 10000,
      TimeoutMs: 30000,
      CreatedUtc: "2025-03-29T11:27:22.814177Z",
    });
    console.log(response, "Webhook rule updated successfully");
  } catch (err) {
    console.log("Error updating Webhook rule:", err);
  }
};

updateWebhookRule();

Delete

To delete an object by GUID, call DELETE /v1.0/tenants/[tenant-guid]/webhookrules/[webhookrule-guid].

curl --location --request DELETE 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/webhookrules/00000000-0000-0000-0000-000000000000' \
--header 'Content-Type: text/plain' \
--header 'Authorization: ••••••' \
--data '{
    "TenantGUID": "05b702a6-9c0e-4741-a465-581f2456e994",
    "Name": "Another Storage Pool",
    "Provider": "Disk",
    "WriteMode": "GUID",
    "UseSsl": false,
    "DiskDirectory": "./disk2/",
    "Dedupe": false,
    "Compress": "None",
    "EnableReadCaching": false,
    "Encrypt": "None"
}'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const deleteWebhookRule = async () => {
  try {
    const response = await api.deleteWebhookRule(
      "59c7402c-dd30-4723-beba-3a3460f26bf7"
    );
    console.log(response, "Webhook rule deleted successfully");
  } catch (err) {
    console.log("Error deleting Webhook rule:", err);
  }
};

deleteWebhookRule();

Check Existence

Note: the HEAD method can be used as an alternative to get to simply check the existence of the object. HEAD requests return either a 200/OK in the event the object exists, or a 404/Not Found if not. No response body is returned with a HEAD request.

curl --location --head 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/webhookrules/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const webhookRuleExists = async () => {
  try {
    const response = await api.existsWebhookRule(
      "b4cf5430-9c25-4514-b3e5-fe7fd1108edb"
    );
    console.log(response, "Webhook rule exists");
  } catch (err) {
    console.log("Error checking Webhook rule:", err);
  }
};

webhookRuleExists();