File not found when downloading file through API
Hi,
We try to download the files attached to our references according to the instructions: https://www.zotero.org/support/dev/web_api/v3/file_upload under 'ii. Download the existing file'.
However, we get a 404 error doing this, even though there is a file in Zotero. The references are in a shared library, so we don't know if that makes any difference. We tested it using /users, but also groups and both result in a 404 error.
Are there any tips to get rid of the 404 error?
Thanks in advance.
We try to download the files attached to our references according to the instructions: https://www.zotero.org/support/dev/web_api/v3/file_upload under 'ii. Download the existing file'.
However, we get a 404 error doing this, even though there is a file in Zotero. The references are in a shared library, so we don't know if that makes any difference. We tested it using /users, but also groups and both result in a 404 error.
Are there any tips to get rid of the 404 error?
Thanks in advance.
We first do a request to the Zotero API, to get the file URL:
$url = "https://api.zotero.org/groups/5349535/items/WY2YNJND"
$options = [
"timeout" => 0
"connect_timeout" => 0
"delay" => 0
"headers" => array:2 [
"Authorization" => "Bearer xxx"
"Zotero-API-Version" => 3
]
"stream" => true
]
That gives me a response with metadata, of which I use the uri. In the publication I'm testing with, this uri is: https://api.zotero.org/groups/5349535/items/WY2YNJND - but when I then redirect the user to this url, the user gets a blank page with the text "Not found"
So I think I'm doing something wrong, but can't really find anything in the documentation about what that might be?
I'm not clear what your use case is, but you can't redirect an external user to an API URL in a private library, if that's what you mean, since it requires authentication. You can download a file to your servers (using /file rather than /file/view) and serve the file yourself, but we don't support public file sharing.
Thanks for the quick responses! Fixed it with the /file addition in the url and a local download