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

REST API: add endpoints for calculation input and output files #957

Closed
waychal opened this issue Nov 28, 2017 · 4 comments
Closed

REST API: add endpoints for calculation input and output files #957

waychal opened this issue Nov 28, 2017 · 4 comments

Comments

@waychal
Copy link
Contributor

waychal commented Nov 28, 2017

For calculation:

  • add endpoint to return list of all input and output files
  • add endpoint to download input and output file
@waychal
Copy link
Contributor Author

waychal commented Dec 6, 2017

add a test where you try to get a file that exists, and another where you try to get a file that does not exist, and a third one where you try to get a file out of the folder with many '..' and check that it complains.

@dev-zero
Copy link
Contributor

I have something similar implemented in another project. Inside one of my calculation resources I return the following:

  "infiles": [
    {
      "_links": {
        "collection": "http://server/base/api/v2/artifacts", 
        "download": "http://server/base/api/v2/artifacts/b560c427-8b72-4264-a896-f0f36f5b549f/download", 
        "self": "http://server/base/api/v2/artifacts/b560c427-8b72-4264-a896-f0f36f5b549f", 
        "view": "http://server/base/api/v2/artifacts/b560c427-8b72-4264-a896-f0f36f5b549f/view"
      }, 
      "id": "b560c427-8b72-4264-a896-f0f36f5b549f", 
      "metadata": {
        "compressed": null
      }, 
      "name": "BASIS_SETS"
    }
  ],
  "outfiles": [
  ]

Now, all of my REST records contain this _links dict with a link to the original resource collection and to themselves. Artifacts (generalized files) got two additional entries there: download and view. I use those two different endpoints (sub-resources) to control the Content-Disposition on the server side to be able to directly return the URL to the user of a web-interface to either view the file in a new tab or then download the file. The self resource returns a more complete json to what is already inside my calculation object with additional metadata.

@waychal waychal added this to the v1.0.0 milestone Dec 3, 2018
@waychal
Copy link
Contributor Author

waychal commented Dec 4, 2018

This issue is already fixed. The only part left is to add test cases.

@sphuber sphuber modified the milestones: v1.0.0, v1.1.0 Apr 3, 2019
@sphuber
Copy link
Contributor

sphuber commented Nov 3, 2019

Fixed in PR #3429

@sphuber sphuber closed this as completed Nov 3, 2019
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

3 participants