/** * Get a template for a new item of a certain type * * @param string $itemType type of item the template is for * @return Item */ public function getTemplateItem($itemType, $linkMode = null) { $newItem = new Item(null, $this); $aparams = array('target' => 'itemTemplate', 'itemType' => $itemType); if ($linkMode) { $aparams['linkMode'] = $linkMode; } $response = $this->request($aparams); if ($response->isError()) { throw new Exception("API error retrieving item template - {$response->getStatus()} : {$response->getRawBody()}"); } libZoteroDebug($response->getRawBody()); $itemTemplate = json_decode($response->getRawBody(), true); $newItem->initItemFromTemplate($itemTemplate); return $newItem; }