Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
dev:web_api:v2:write_requests [2013/02/09 23:49] – [Creating Multiple Objects] dstillman | dev:web_api:v2:write_requests [2014/07/02 14:22] – [Zotero Server Write Requests] dstillman |
---|
====== Zotero Server Write Requests ====== | ====== Zotero Server Write Requests ====== |
| |
This page documents the write methods of the [[start|Zotero Server API]]. See the [[Read Requests]] page for basic information on accessing the API, including possible HTTP status codes not listed here. | **This is version 2 of the Zotero Web API. For new development, use [[:dev/web_api/v3/start|API version 3]].** |
| |
| This page documents the write methods of the [[start|Zotero Web API]]. See the [[Read Requests]] page for basic information on accessing the API, including possible HTTP status codes not listed here. |
| |
An API key with write access to a given library is necessary to use write methods. | An API key with write access to a given library is necessary to use write methods. |
| |
See [[#creating_multiple_objects|Creating Multiple Objects]] for more information on the response format. | See [[#creating_multiple_objects|Creating Multiple Objects]] for more information on the response format. |
| |
==== Creating Multiple Items ==== | ==== Creating Multiple Items ==== |
| |
See [[#creating_multiple_objects|Creating Multiple Objects]]. | See [[#creating_multiple_objects|Creating Multiple Objects]]. |
| |
==== Updating an Existing Item ==== | ==== Updating an Existing Item ==== |
| |
==== Updating Multiple Items ==== | ==== Updating Multiple Items ==== |
| |
See the [[#updating_multiple_objects|Updating Multiple Objects]]. | See [[#updating_multiple_objects|Updating Multiple Objects]]. |
==== Deleting an Item ==== | ==== Deleting an Item ==== |
| |
==== Creating Multiple Objects ==== | ==== Creating Multiple Objects ==== |
| |
Multiple collections, saved searches, and items can be created in the same requests by including multiple objects in the ''collections'', ''searches'', and ''items'' properties: | Up to 50 collections, saved searches, or items can be created in a single request by including multiple objects in the ''collections'', ''searches'', or ''items'' property: |
| |
POST <userOrGroupPrefix>/collections | POST <userOrGroupPrefix>/collections |
| |
=== Updating Multiple Objects === | === Updating Multiple Objects === |
| |
| Up to 50 collections, saved searches, or items can be updated in a single request. |
| |
Follow the instructions in [[#creating_multiple_objects|Creating Multiple Objects]], but add an ''itemKey'', ''collectionKey'', or ''searchKey'' property to each object. Pass the current library version as ''If-Unmodified-Since-Version'', replacing ''Zotero-Write-Token'', or include an ''itemVersion'', ''collectionVersion'', or ''searchVersion'' in each object. | Follow the instructions in [[#creating_multiple_objects|Creating Multiple Objects]], but add an ''itemKey'', ''collectionKey'', or ''searchKey'' property to each object. Pass the current library version as ''If-Unmodified-Since-Version'', replacing ''Zotero-Write-Token'', or include an ''itemVersion'', ''collectionVersion'', or ''searchVersion'' in each object. |
| |
Items can also include ''dateAdded'' and ''dateModified'' properties containing UTC timestamps in SQL DATETIME format (e.g., "2012-10-03 16:42:12"). ''dateAdded'' should be specified only on new items; passing a different ''dateAdded'' in an update will result in a ''409'' (?) error. | Items can also include ''dateAdded'' and ''dateModified'' properties containing UTC timestamps in SQL DATETIME format (e.g., "2012-10-03 16:42:12"). If ''dateAdded'' is included with an existing item, it must match the existing ''dateAdded'' value or else the API will return a 400 error. If a new ''dateModified'' time is not included with an update to existing item, the item's ''dateModified'' value will be set to the current time. |
| |
Creators, tags, and relations are included in item objects and cannot be modified separately. | Creators, tags, and relations are included in item objects and cannot be modified separately. |