Open zhiyuli opened 5 years ago
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.
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
hydroshare work will be done in https://github.com/hydroshare/hydroshare/issues/3088
@sblack-usu
I am ok with returning the whole json body. I can extract the file_id by myself. Thanks!
file_id = hs.addResourceFile(resource_id, file_local_path)
does not return the file_id newly created. it returns res_id