Delete Rule

Deletes a rule.

Request

Request syntax:

DELETE /rules/Rule ID

Define the following variable when submitting the above request:

VariableA variable represents a value that must be replaced. A variable consists of either a URL segment (e.g., "0001" in /0001/) or a query string value (e.g., "3" in mediaTypes=3).Description
Rule ID RequiredIdentifies 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

Call the delete_rule module (Python 3) to delete a rule. This module imports names from the api_auth module.

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'
}