src/CampaignAdmin.php
public function deleteCampaign(HTTPRequest $request)
    {
        // Check security ID
        if (!SecurityToken::inst()->checkRequest($request)) {
            return new HTTPResponse(null, 400);
        }

        $id = $request->param('ID');
        if (!$id || !is_numeric($id)) {
            return (new HTTPResponse(null, 400));
        }

        $record = ChangeSet::get()->byID($id);
        if (!$record) {
            return (new HTTPResponse(null, 404));
        }

        if (!$record->canDelete()) {
            return (new HTTPResponse(null, 403));
        }

        $record->delete();

        return (new HTTPResponse(null, 204));
    }
public function deleteCampaign(HTTPRequest $request)
    {
        // Check security ID
        if (!SecurityToken::inst()->checkRequest($request)) {
            return new HTTPResponse(null, 400);
        }

        $id = $request->param('ID');
        if (!$id || !is_numeric($id)) {
            return (new HTTPResponse(null, 400));
        }

        $record = ChangeSet::get()->byID($id);
        if (!$record) {
            return (new HTTPResponse(null, 404));
        }

        if (!$record->canDelete()) {
            return (new HTTPResponse(null, 403));
        }

        $record->delete();

        return (new HTTPResponse(null, 204));
    }
public function deleteCampaign ( HTTPRequest $ request ) { // Check security ID if ( ! SecurityToken :: inst ( ) -> checkRequest ( $ request ) ) { return new HTTPResponse ( null , 400 ) ; } $ id = $ request -> param ( 'ID' ) ; if ( ! $ id || ! is_numeric ( $ id ) ) { return ( new HTTPResponse ( null , 400 ) ) ; } $ record = ChangeSet :: get ( ) -> byID ( $ id ) ; if ( ! $ record ) { return ( new HTTPResponse ( null , 404 ) ) ; } if ( ! $ record -> canDelete ( ) ) { return ( new HTTPResponse ( null , 403 ) ) ; } $ record -> delete ( ) ; return ( new HTTPResponse ( null , 204 ) ) ; }
REST endpoint to delete a campaign.

@param HTTPRequest $request

@return HTTPResponse
REST endpoint to delete a campaign .