On a groovy rest script, I want to trigger some changes to a group of pages (as returned by Crafter Search), so I start by getting
siteItemService.getSiteItem( pages[1].localId )
You can't make content changes using Crafter Engine, as it's a delivery system. For content changes, you'll need to use Crafter Studio and its workflow mechanics.