Overview# In the following article, I described how to create new content.
This time, I’ll try updating and deleting existing content.
Filtering Items# With the following program, you can retrieve registered content. This time, I retrieved content with the title “Pre-update title.” res["data"] is an array.
u p h q } i f f f e r r l s a o u t i o i n e e e s s e e l r l d = s n r s t r m t t p ( n w y " _ e k f e o r = r a o = t t r e i r i e e m r = i y s y l _ n q r s e d " t p , t s t u . [ x { l e = e t e j ' = = x e v r r = s s d x " = [ a s t o a " " " : ] l . = f s n t x x " u a ' . ( a x x " a e p ' { g ) ' x x 更 r p & h e ] " " 新 t i e ' o t ) 前 i n n . s ( の c d j t e タ l q ( o } n イ e u f i / d ト " e ' n j p ル r f ( s o " y i f o i . l i n n i t l a t t e t p , e r e i m [ r / h s { s n e ( k ) o a ) e d d : y e e } / r ] { s = i = { t h v e e a m a l _ d u t e e y r } p s ' e , ) } ? a { u f t i h l = t ( e u r s _ e s r t n r a } m ' e , p a s s w o r d ) )
Getting the ID of the Content to Update# An ID like 730f844d-b476-4485-8957-c33fccb7f8ac is obtained.
i i t t e e m m _ = i d r e = s [ i ' t d e a m t [ a ' ' i ] d [ ' 0 ] ]
Updating# Specify the type and id to update.
p } u r r a r . y l = j l s o " } = r o a d e n d a f q ( t " u ) = a " " " } { e " t i a h s { : y d t o t p " t s s { e : r " t . " i t } p : i b i / a t u t j t f e t l s c " m e e o h n _ s " n ( o i " : a u d d : p r e , " i l - { 更 / , - 新 n { 後 o h i の d e t タ e a e イ / d m ト { e _ ル i r t " t s y e = p m h e _ e } t a " y d , p e e r } s / , { i a t u e t m h _ = i ( d u } s " e r n a m e , p a s s w o r d ) , j s o n = p a y l o a d )
Deleting# Deletion can be executed as follows.
r e q u e s t s . d e l e t e ( u r l , a u t h = ( u s e r n a m e , p a s s w o r d ) )
Summary# I hope this serves as a useful reference when editing content on Drupal programmatically.