Zotero write api returning 403
Hi,
can any developer help me in understanding why the zotero write api is returning 403 (forbidden) status.
POST url : 'https://api.zotero.org/users/<userid>/items'
header : 'Content-Type': 'application/json'
data : '{"items": [{"extra": "", "language": "", "itemType": "webpage", "shortTitle": "", "title": "DjangoTricks: Basics", "url": "http://djangotricks.blogspot.in/search/label/Basics", "notes": [], "rights": "", "attachments": [], "accessDate": "2013-03-16 05:04:21", "websiteType": "", "date": "", "abstractNote": "1112233", "creators": [{"lastName": "test", "creatorType": "contributor", "firstName": "test2"}], "tags": [], "websiteTitle": ""}]}'
can any developer help me in understanding why the zotero write api is returning 403 (forbidden) status.
POST url : 'https://api.zotero.org/users/<userid>/items'
header : 'Content-Type': 'application/json'
data : '{"items": [{"extra": "", "language": "", "itemType": "webpage", "shortTitle": "", "title": "DjangoTricks: Basics", "url": "http://djangotricks.blogspot.in/search/label/Basics", "notes": [], "rights": "", "attachments": [], "accessDate": "2013-03-16 05:04:21", "websiteType": "", "date": "", "abstractNote": "1112233", "creators": [{"lastName": "test", "creatorType": "contributor", "firstName": "test2"}], "tags": [], "websiteTitle": ""}]}'
This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.
https://groups.google.com/forum/?fromgroups=#!forum/zotero-dev
Actually i figured it out, the zotero API documentation is faulty which states :
Creating an Item
POST <userOrGroupPrefix>/items
Content-Type: application/json
Zotero-Write-Token: <write token>
that results in wrong api url:
'https://api.zotero.org/users/<userid>/items'
but the actual post url should be:
'https://api.zotero.org/users/<userid>/items?key=<apikey>
It works like a charm after this correction.
It's assumed that you'll do this in your code automatically for all such requests, so we don't clutter the documentation by showing it with every example.
i missed the detail :
An API key with write access to a given library is necessary to use write methods.
thanks !