Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoint to support direct download of specific package or extension #90

Open
jcfr opened this issue May 19, 2021 · 0 comments
Open

Comments

@jcfr
Copy link
Collaborator

jcfr commented May 19, 2021

Is your feature request related to a problem? Please describe.

Downloading a specific package without using the python client currently requires multiple calls. This lead to complex implementation.

For example:

# Get app_id
app_id=$(curl -X GET --header "Accept: application/json" "https://slicer-packages.kitware.com/api/v1/app?name=Slicer" | jq ".[0]._id" -r)
https://slicer-packages.kitware.com/api/v1/app?name=Slicer

app_id=5f4474d0e1d8c75dfc705482
echo "app_id: ${app_id}"

# Get item_id
revision=29917
os=macosx
arch=amd64
item_id=$(curl -X GET --header "Accept: application/json" "https://slicer-packages.kitware.com/api/v1/app/${app_id}/package?os=${os}&arch=${arch}&revision=${revision}" -s | jq ".[0]._id" -r)
echo "item_id: ${item_id}"

# Get file_id
curl -X GET "https://slicer-packages.kitware.com/api/v1/item/${item_id}/download" -O

Describe the solution you'd like

Add new endpoints.

There are few possible approaches to define the routes

Explicitly include release_id_or_name, os, arch, revision

For example:

GET /app/:app_id_or_name/:release_id_or_name/package/:os/:arch/:revision/download
GET /app/:app_id_or_name/:release_id_or_name/extension/:os/:arch/:revision/download

where:

  • app_id_or_name: 5f4474d0e1d8c75dfc705482 or Slicer
  • release_id_or_name: draft, release name like 4.10, or id of the release
  • os: linux, macosx or `win
  • arch: amd64
  • revision: 29917

Examples:

/app/Slicer/4.15/package/macosx/amd64/29917/download
/app/Slicer/draft/package/macosx/amd64/29917/download

Only with os, arch, revision

GET /app/:app_id_or_name/package/:os/:arch/:revision/download
GET /app/:app_id_or_name/extension/:os/:arch/:revision/download

and then additional parameter would be passed using &param1=value1.

All filters as parameters

GET /app/:app_id_or_name/package/download
GET /app/:app_id_or_name/extension/download

If more than packages is found, report an error requesting user to be more specific with specific filters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant