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:
- Get the package ID using the package name and version.
- List package files using pagination.
- 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:
- Accept parameters for project ID, package name, and package version.
- Return a zip file containing all files from the specified package.
- Handle pagination internally.
- Preserve the original directory structure of the package.
Benefits:
- Simplifies the download process for users.
- Reduces the number of API calls required.
- Eliminates the need for complex scripting to handle pagination and filename encoding.
- 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 🤖