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

hs.addResourceFile() should return file_id newly created #98

Open
zhiyuli opened this issue Jan 11, 2019 · 4 comments
Open

hs.addResourceFile() should return file_id newly created #98

zhiyuli opened this issue Jan 11, 2019 · 4 comments

Comments

@zhiyuli
Copy link
Member

zhiyuli commented Jan 11, 2019

file_id = hs.addResourceFile(resource_id,
file_local_path)

does not return the file_id newly created. it returns res_id

@sblack-usu sblack-usu self-assigned this Jan 14, 2019
@sblack-usu
Copy link
Contributor

I agree it should return the file_id, or at least the response body, which includes the file_id. Are you okay with me returning the whole response which will be a json map with the resource_id and file_id? The resource_id is kind of useless in the response, but it's there and I'd like to rest client to return the response instead of parsing it and tossing the rest.

@sblack-usu
Copy link
Contributor

This has work on both the python rest_client and the rest_api. The rest_api will need to be updated to include the file_id in the response. Currently it only returns the resource_id and file_name.
https://github.com/hydroshare/hydroshare/blob/develop/hs_core/views/resource_rest_api.py#L1128

The rest_client will have to be updated to return the json body for the response instead of parsing out the resource_id and returning only the resource_id.
https://github.com/hydroshare/hs_restclient/blob/master/hs_restclient/__init__.py#L870

@sblack-usu
Copy link
Contributor

hydroshare work will be done in hydroshare/hydroshare#3088

@zhiyuli
Copy link
Member Author

zhiyuli commented Jan 16, 2019

@sblack-usu

I am ok with returning the whole json body. I can extract the file_id by myself. Thanks!

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

2 participants