import requests
import json


def api_delete(url, endpoint, token, data=""):
    """
    Method to query the Prisma Cloud CSPM API using the DELETE method
    Returns requests object
    """
    r_url = "https://{}{}".format(url, endpoint)
    r_headers = {
        'content-Type': 'application/json; charset=UTF-8',
        'x-redlock-auth': '{}'.format(token),
    }
    r = requests.delete(r_url, headers=r_headers, data=json.dumps(data))
    return r