New API endpoint for downloading all files from a generic package

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Background

Downloading all files from a generic package requires multiple API calls and complex scripting to handle pagination and filename encoding. To simplify this process and improve user experience, we propose creating a new API endpoint specifically for downloading all files from a generic package.

Current situation:

  • There is no single endpoint to retrieve all files from a generic package.
  • Users need to make multiple API calls:
    1. Get the package ID using the package name and version.
    2. List package files using pagination.
    3. Download each file individually.
  • Filenames with directory separators are URL-encoded, causing issues with local directory creation.

Proposed solution:

Create a new API endpoint: /api/v4/projects/:id/packages/generic/:package_name/:package_version/download

This endpoint would:

  1. Accept parameters for project ID, package name, and package version.
  2. Return a zip file containing all files from the specified package.
  3. Handle pagination internally.
  4. Preserve the original directory structure of the package.

Benefits:

  1. Simplifies the download process for users.
  2. Reduces the number of API calls required.
  3. Eliminates the need for complex scripting to handle pagination and filename encoding.
  4. Improves performance by bundling all files into a single download.

Example usage:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
     --output package_files.zip \
     "https://gitlab.example.com/api/v4/projects/:id/packages/generic/:package_name/:package_version/download"
Edited by 🤖 GitLab Bot 🤖