Delete Audience

Deletes an audience or superaudience.

Request

Request syntax:

DELETE /audiences/Audience 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
Audience ID RequiredIdentifies an audience by its system-defined or external ID. Use the Get Multiple Audiences endpoint to retrieve a list of audiences/superaudience 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 Audience.
messageStringReturns Deleted.

Sample Request/Response

Call the delete_audience module (Python 3) to delete an audience or superaudience. This module imports names from the api_auth module.

import json, requests
from api_auth import APICredentials, APIParams
audience_id = 'Hak3zjnPLSW5o0j8GMpzRMsa' # Replace with the ID for the desired audience.

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

    def run(self):
        """
        Deletes an audience.
        """
        self._delete_audience()

    def _delete_audience(self):
        url = "{}{}{}".format(self.host, "/api/v4/audiences/", audience_id)

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

        print(response.json())

DeleteAudience().run()

Response:

{
	'@id': '/api/v4/audiences/Hak3zjnPLSW5o0j8GMpzRMsa',
	'@type': 'Audience',
	'message': 'Deleted'
}