$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 $updatedItem = new Zotero_Item($updateItemResponse->getBody()); $library->items->replaceItem($updatedItem); echo "Item updated\n\n\n<br />"; //try to get the items we just created separately to make sure the api has them //and they've been updated correctly $existingItemKey = $existingItem->itemKey; echo "getting existing item\n<br />"; $retrievedExistingItem = $library->loadItem($existingItemKey); echo "got existing item\n<br />";