Both sides previous revisionPrevious revisionNext revision | Previous revision |
dev:web_api:v3:write_requests [2024/10/10 02:00] – Deemphasize Zotero-Write-Token dstillman | dev:web_api:v3:write_requests [2024/10/10 02:10] (current) – Keep Zotero-Write-Token before If-Unmodified-Since-Version for now dstillman |
---|
POST <userOrGroupPrefix>/items | POST <userOrGroupPrefix>/items |
Content-Type: application/json | Content-Type: application/json |
If-Unmodified-Since-Version: <last library version> or Zotero-Write-Token: <write token> | Zotero-Write-Token: <write token> or If-Unmodified-Since-Version: <last library version> |
| |
<code>[ | <code>[ |
| ''400 Bad Request'' | Invalid type/field; unparseable JSON | | | ''400 Bad Request'' | Invalid type/field; unparseable JSON | |
| ''409 Conflict'' | The target library is locked. | | | ''409 Conflict'' | The target library is locked. | |
| ''412 Precondition Failed'' | The provided ''Zotero-Write-Token'' has already been submitted. | | | ''412 Precondition Failed'' | The version provided in ''If-Unmodified-Since-Version'' is out of date, or the provided ''Zotero-Write-Token'' has already been submitted. | |
| ''413 Request Entity Too Large'' | Too many items submitted | | | ''413 Request Entity Too Large'' | Too many items submitted | |
| |
POST <userOrGroupPrefix>/collections | POST <userOrGroupPrefix>/collections |
Content-Type: application/json | Content-Type: application/json |
If-Unmodified-Since-Version: <last library version> or Zotero-Write-Token: <write token> | Zotero-Write-Token: <write token> or If-Unmodified-Since-Version: <last library version> |
| |
<code>[ | <code>[ |
POST <userOrGroupPrefix>/searches | POST <userOrGroupPrefix>/searches |
Content-Type: application/json | Content-Type: application/json |
If-Unmodified-Since-Version: <last library version> or Zotero-Write-Token: <write token> | Zotero-Write-Token: <write token> or If-Unmodified-Since-Version: <last library version> |
| |
<code>[ | <code>[ |
POST <userOrGroupPrefix>/collections | POST <userOrGroupPrefix>/collections |
Content-Type: application/json | Content-Type: application/json |
| Zotero-Write-Token: <write token> or If-Unmodified-Since-Version: <last library version> |
| |
<code>[ | <code>[ |
''Zotero-Write-Token'' is an optional HTTP header, containing a client-generated random 32-character identifier string, that can be included with unversioned write requests to prevent them from being processed more than once (e.g., if a user clicks a form submit button twice). The Zotero server caches write tokens for successful requests for 12 hours, and subsequent requests from the same API key using the same write token will be rejected with a ''412 Precondition Failed'' status code. If a request fails, the write token will not be stored. | ''Zotero-Write-Token'' is an optional HTTP header, containing a client-generated random 32-character identifier string, that can be included with unversioned write requests to prevent them from being processed more than once (e.g., if a user clicks a form submit button twice). The Zotero server caches write tokens for successful requests for 12 hours, and subsequent requests from the same API key using the same write token will be rejected with a ''412 Precondition Failed'' status code. If a request fails, the write token will not be stored. |
| |
If using versioned write requests (i.e., those that include an ''If-Unmodified-Since-Version'' HTTP header or individual object ''version'' properties), ''Zotero-Write-Token'' is redundant and should be omitted. | If using [[syncing#version_numbers|versioned write requests]] (i.e., those that include an ''If-Unmodified-Since-Version'' HTTP header or individual object ''version'' properties), ''Zotero-Write-Token'' is redundant and should be omitted. |
| |
===== Examples ===== | ===== Examples ===== |
| |
See the [[Syncing]] page for an example workflow that puts together read and write methods for complete and efficient syncing of Zotero data via the API. | See the [[Syncing]] page for an example workflow that puts together read and write methods for complete and efficient syncing of Zotero data via the API. |