Task #7100
closedAssistance in using HomeLibrary REST Interface
100%
Description
Hello, i'm currently testing the HL REST interface for CLS AAPS needs, following this page https://wiki.gcube-system.org/gcube/Home_Library_REST_API#Get_started
Before testing the target method we need (local file upload), i'm trying to familiarize with simple GET methods, i've tested the GetPublicLink method.
with GET operation, adding one of my VRE token as header "gcube-token (the one of VRE 'AquacultureAtlasGeneration'). I always get a response '0' after 40s.
Questions:
- Is it something wrong with the above URL? any missing header?
- which token can we use? (i suppose that we can use whatever VRE token to access workspace, with the condition that the VRE scope is registered for this REST web-service)
- by chance, would have set-up a standard documentation/testing swagger UI for such web-services?
Thanks in advance
Files
Updated by Emmanuel Blondel over 8 years ago
sorry i've pasted the wrong link: this is the one i've tested: http://workspace-repository.d4science.org:8080/home-library-webapp/rest/GetPublicLink?absPath=/Home/emmanuel.blondel/Workspace/mpa-web.zip
Updated by Roberto Cirillo over 8 years ago
- Category set to Application
- Assignee set to Valentina Marioli
Updated by Valentina Marioli over 8 years ago
- Status changed from New to In Progress
Updated by Valentina Marioli over 8 years ago
The file /Home/emmanuel.blondel/Workspace/mpa-web.zip does not exist. Please, try using an existing file.
Sorry, my mistake, the file exists.
Updated by Valentina Marioli over 8 years ago
Could you please try to list a folder?
https://workspace-repository.d4science.org/home-library-webapp/rest/List?absPath=/Home/emmanuel.blondel/Workspace/
Is it working?
You can use whatever production VRE token to access the REST web-service.
Please, let me know what VRE token you are using.
Updated by Emmanuel Blondel over 8 years ago
curl --header "gcube-token: " https://workspace-repository.d4science.org/home-library-webapp/rest/List?absPath=/Home/emmanuel.blondel/Workspace/
Indeed , i've check the token and mine was wrong, i could use successfully Lisy
, and GetPublicLink
operations.. Apologies, i should have checked better
I'm now testing the file upload (which is the one we need), please leave open this ticket, in case i have problem with the upload operation i will ask you here ASAP.
Thanks
Updated by Emmanuel Blondel over 8 years ago
Dear Valentina, i'm struggling with the HL REST API to upload a file... Could you please assist us on this? a cURL command line to apply for this would be very helpful.. and would help me implement in Python (as it is expected). I attach here the file (unzip it) i try to upload into my workspace. Thanks for your support
Updated by Valentina Marioli over 8 years ago
- Tracker changed from Support to Task
- Priority changed from High to Normal
- % Done changed from 0 to 50
To upload a file using cURL:
curl --header "gcube-token: *******************************" /
--request POST --data-binary @/home/valentina/test.jpg /
--header "Content-Type: image/jpeg" /
'https://workspace-repository.d4science.org/home-library-webapp/rest/Upload?name=test.jpg&description=test&parentPath=/Home/mylogin/Workspace/myFolder'
Please, replace the parameters with the right information. Remember, when you use "--data-binary" you always have to set the right Content-Type.
To unzip a file using cURL:
curl --header "gcube-token: *******************************" /
--request POST --data-binary @/home/valentina/fusion-forms.zip /
--header "Content-Type: application/zip" /
'https://workspace-repository.d4science.org/home-library-webapp/rest/Unzip?name=fusion-forms.zip&parentPath=/Home/mylogin/Workspace/myFolder&replace=false&hardReplace=false'
I'm adding cURL examples to the HL wiki page in order to help you to use the HL Rest API.
Support tickets are not supposed to be used for assistance, but for something that is not working as aspect. So, I'm going to change the Tracker from Support to Task.
If you have problems, please, open a new support ticket.
Sorry, but I can't help you with Python. Let me know if cURL is working to upload and unzip files.
Updated by Valentina Marioli over 8 years ago
- Status changed from In Progress to Feedback
- Assignee changed from Valentina Marioli to Emmanuel Blondel
Updated by Emmanuel Blondel over 8 years ago
- Status changed from Feedback to Closed
The above upload didn't work, but in the meantime i could find my solution directly in Python.