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

Provide API for download file from provider URL #4

Open
alphakevin opened this issue Dec 19, 2017 · 3 comments
Open

Provide API for download file from provider URL #4

alphakevin opened this issue Dec 19, 2017 · 3 comments
Assignees
Labels
Milestone

Comments

@alphakevin
Copy link
Contributor

alphakevin commented Dec 19, 2017

Description

  1. Client request for original URL of specified file.
  2. Server redirects or returns signed URL points to provider.
  3. Client get the file or make another request with the returned URL.

Sketch

Redirect

GET http://server-host/api/namespaces/:namespace/files/:files_id/download?origin=1

Response

HTTP/1.1 301 Moved Permanently
Location: <origin-url>

Fetch URL

GET http://server-host/api/namespaces/:namespace/files/:files_id/origin-url?download=1

Response

{
  url: '<origin-url>',
}

Batch fetch URLs

POST http://server-host/api/namespaces/:namespace/urls
{
  download: true,
  origin: true,
  files: [
    '<file1_id>',
    '<file2_id>',
    ...
  ]
}

Response

[
  {
    id: '<file1_id>',
    url: '<url1>',
  },
  {
    id: '<file2_id>',
    url: '<url2>',
  },
  ...
]
@alphakevin alphakevin self-assigned this Dec 19, 2017
@alphakevin alphakevin added this to the ready to open milestone Dec 19, 2017
@alphakevin alphakevin changed the title Provide new API for download file from provider URL Provide API for download file from provider URL Dec 20, 2017
@zhf
Copy link

zhf commented Jan 24, 2018

By client, you mean cube-server or end-user?
and server...

@alphakevin
Copy link
Contributor Author

alphakevin commented Jan 26, 2018

@zhf the client is a nexusdocs-client instance or the app using it, the server is the nexusdocs-server instance.

Requested url could be generated earlier, and when user request for the url, if origin parameter is set true and not using a native gridfs provider, the server will redirect user to the original url of the provider.

@alphakevin
Copy link
Contributor Author

Converting images is also supported by Ali OSS provider now!

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

No branches or pull requests

2 participants