if ($createItemResponse->isError()) { echo $createItemResponse->getStatus() . "\n"; echo $createItemResponse->getBody() . "\n"; die("Error creating Zotero item\n\n"); } else { //load the item into the library so it is included and has the itemKey and etag //and anything else the api populates that we didn't set in our item $createItemFeed = new Zotero_Feed($createItemResponse->getBody()); $createdItem = $library->items->addItemsFromFeed($createItemFeed); $createdItem = $createdItem[0]; echo "Item created\n\n\n<br />"; } $existingItem = new Zotero_Item($createItemResponse->getBody()); //add child note $newNoteItem = $library->getTemplateItem('note'); $addNoteResponse = $library->addNotes($existingItem, $newNoteItem); if ($addNoteResponse->isError()) { echo $addNoteResponse->getStatus() . "\n"; echo $addNoteResponse->getBody() . "\n"; die("error adding child note to item"); } echo "added child note\n\n<br />"; $existingItem->set('date', '2011'); //$existingItem->set('deleted', 1); $updateItemResponse = $library->writeUpdatedItem($existingItem); if ($updateItemResponse->isError()) { echo "<br /><br />\n\n" . $updateItemResponse->getStatus(); echo "<br /><br />\n\n" . $updateItemResponse->getBody(); die("Error updating Zotero item\n\n"); } //replace the item in library->items with the api response