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

        $campaignID = $request->param('CampaignID');
        $itemID = $request->param('ItemID');

        if (!$campaignID ||
            !is_numeric($campaignID) ||
            !$itemID ||
            !is_numeric($itemID)) {
            return (new HTTPResponse(null, 400));
        }

        /** @var ChangeSet $campaign */
        $campaign = ChangeSet::get()->byID($campaignID);
        /** @var ChangeSetItem $item */
        $item = ChangeSetItem::get()->byID($itemID);
        if (!$campaign || !$item) {
            return (new HTTPResponse(null, 404));
        }


        $campaign->removeObject($item->Object());

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

        $campaignID = $request->param('CampaignID');
        $itemID = $request->param('ItemID');

        if (!$campaignID ||
            !is_numeric($campaignID) ||
            !$itemID ||
            !is_numeric($itemID)) {
            return (new HTTPResponse(null, 400));
        }

        /** @var ChangeSet $campaign */
        $campaign = ChangeSet::get()->byID($campaignID);
        /** @var ChangeSetItem $item */
        $item = ChangeSetItem::get()->byID($itemID);
        if (!$campaign || !$item) {
            return (new HTTPResponse(null, 404));
        }


        $campaign->removeObject($item->Object());

        return (new HTTPResponse(null, 204));
    }
public function removeCampaignItem ( HTTPRequest $ request ) { // Check security ID if ( ! SecurityToken :: inst ( ) -> checkRequest ( $ request ) ) { return new HTTPResponse ( null , 400 ) ; } $ campaignID = $ request -> param ( 'CampaignID' ) ; $ itemID = $ request -> param ( 'ItemID' ) ; if ( ! $ campaignID || ! is_numeric ( $ campaignID ) || ! $ itemID || ! is_numeric ( $ itemID ) ) { return ( new HTTPResponse ( null , 400 ) ) ; } /** @var ChangeSet $campaign */ $ campaign = ChangeSet :: get ( ) -> byID ( $ campaignID ) ; /** @var ChangeSetItem $item */ $ item = ChangeSetItem :: get ( ) -> byID ( $ itemID ) ; if ( ! $ campaign || ! $ item ) { return ( new HTTPResponse ( null , 404 ) ) ; } $ campaign -> removeObject ( $ item -> Object ( ) ) ; return ( new HTTPResponse ( null , 204 ) ) ; }
REST endpoint to delete a campaign item.

@param HTTPRequest $request

@return HTTPResponse
REST endpoint to delete a campaign item .