Create zip download - HTTP Error 404
Good day,
What does HTTP Error 404 mean when returned when calling "Create zip download" API? That code is not defined in the online manual https://developer.box.com/reference/post-zip-downloads/#request-example
It seems my curl call is successfully authenticated and returns download_url and status_url. The download_url has no content when opening with a browser.
While status_url page
contains error 404:
{"status":404,"type":"error","message":"Resource not found","code":"not_found","context_info":null,"help_url":"http://developers.box.com/docs/#errors","request_id":"b6ivr9c7di2fnn0eev7n7fvbms"}
The curl call contains a single type "file" and respective "id".
It seems to me that I'm missing something important get this working.
I hope you could advise.
Thank you.
Kind regards,
-
Hi,
apparently, error 404 is related to user authentication.
Not sure why is error 404 as the user making the ZIP call (using the Bearer DEV_TOKEN) and the user logged in the browser is the same.
I did check using the Get User API call.
It would be great if someone shares a working Python example on how to use the ZIP Download API call.
Kind regards,
-
Hi,
Observed error 404 in the browser is because the ZIP Download URL is "alive" for only a few seconds.
The download should start immediately after the ZIP download URL is returned.
Handling of errors is required as the download "curl" fails if the ZIP preparation "curl" takes more than a few seconds.
Bash script below worked more or less.
============================ Bash script to ZIP a folder ===============
#!/bin/bash
TOKEN=YOUR_DEV_TOKEN
DOWNLOAD_FILE=file1.zip
FOLDER_ID=1022034050DOWNLOAD_URL=`curl -i -X POST "https://api.box.com/2.0/zip_downloads" \
-H "Authorization: Bearer ${TOKEN}" \
-d '{
"download_file_name": "${DOWNLOAD_FILE}",
"items": [
{
"type": "folder",
"id": "${FOLDER_ID}"
}
]
}' | grep download | cut -d":" -f2,3 | cut -d"," -f1 | sed 's/"//g' `echo "DOWNLOAD_URL -> ${DOWNLOAD_URL}"
curl -i -X GET ${DOWNLOAD_URL} > ${DOWNLOAD_FILE}
==================================Kind regards,
投稿コメントは受け付けていません。
コメント
2件のコメント