Overview

I had the opportunity to bulk delete multiple content items using the Drupal REST API, so this is a memo of the process.

References

For a method to bulk delete content without using the REST API, please refer to the following.

Preparation

First, enable the HTTP Basic Authentication module and the JSON:API module.

Additionally, enable DELETE in REST resources.

/admin/config/services/rest

Execution Example

The following custom library is used.

https://github.com/nakamura196/drupal_tools

You can also review the processing details at the following link.

https://nakamura196.github.io/drupal_tools/

Installation

pipinstallgit+https://github.com/nakamura196/drupal_tools

Preparing the .env File

DDDRRRUUUPPPAAALLL___UUPRSALES=RShNWtAOtMRpED:==/up/saeesxrsanwmaopmrlede.org/drupal

Execution

Run as follows.

item_ids is a list of unique values corresponding to field_name (in this case, field_item_id).

fid#i#D#dfnrrmetRriieopfCeLUCuedsmoamoPrplsurg#dirl_aAeadldteftelidLal_=trtLetd_tnsup_o=mutsDUe=adpaia_rhrRmr=antdpine=uLaDeuldeddp,nrpd_ama.sifgau=arts_rtuelDipluoiCe=entRna".poadSamc_cUslfgalssVd[_tirPtAiels(_riiteAaPet..p)fcodoedLnIl_dad:iswsnme_cCdneplv[_nUel_ilie("titSiide"aodiEoetstic.ssaRfne(emo/sg(lNtmi_pnuee)sAt(_tfotuttMhDierrai_fEeRdmotidutr,U"_mnsuhoDPi_Di.iemDrAdnrncdRuLsiugs"laUp_,dpv]iPaUsai"s.AlRf(lt)fteLALinAeon_P,eiPmrovPIldIfACDdsCi_fSlR_)ld,iiSiUnistlWePaereeOnAmniomRtLetnwuD_)tiswUoidi=iSnsntEa.gDhRdrNDftutAa.hphMtieaeEatl,FeDAlrrrPoDaruIaRmopCdUewaleP.slidA(AeL)Pnc_]ItrPC.eAlldSioeSeanWndtOt_iR.caDrl)esd.entials("../.env")

Summary

Please note that there may be bugs, so exercise caution when using this.

I hope this serves as a helpful reference.