Delete Rule

v4

Deletes a rule.

Request

Request syntax:

DELETE /rules/{Rule ID}

Define the following variable when submitting the above request:

VariableDescription
Rule IDRequired. Identifies a rule by its system-defined or external ID. Use the Get Multiple Rules endpoint to retrieve a list of rules and their IDs.

Response

A successful request returns a 200 OK response that contains the following properties:

NameData TypeDescription
@idStringIndicates the relative path to the requested endpoint.
@typeStringReturns Rule.
messageStringReturns Deleted.

Sample Request/Response

The code below (Python 3) shows how to delete a rule.

This code imports names from the api_auth module for V4 APIs (see below).

import json, requests
from api_auth import APICredentials, APIParams
rule_id = 'c1eb5a555b9d45b7a43552f65a268075' # Replace with the ID for the desired rule.

class DeleteRule:
    def __init__(self):
        self.host = "https://services.uplynk.com"

    def run(self):
        """
        Deletes a rule.
        """
        self._delete_rule()

    def _delete_rule(self):
        url = "{}{}{}".format(self.host, "/api/v4/rules/", rule_id)

        response = requests.delete(
            url, params=APIParams(APICredentials()).get_params({})
        )

        print(response.json())

DeleteRule().run()

Response:

{
	"@id": "/api/v4/rules/c1eb5a555b9d45b7a43552f65a268075",
	"@type": "Rule",
	"message": "Deleted"
}