Welcome to the new Box Support website. Check out all the details here on what’s changed.

Create zip download - HTTP Error 404

New post

Comments

2 comments

  • Marin Botev

    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,

     

    0
    Comment actions Permalink
  • Marin Botev

    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=1022034050

    DOWNLOAD_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,

    0
    Comment actions Permalink

Post is closed for comments.