Task #7100

Assistance in using HomeLibrary REST Interface

Added by Emmanuel Blondel almost 3 years ago. Updated almost 3 years ago.

Status:ClosedStart date:Feb 17, 2017
Priority:NormalDue date:
Assignee:Emmanuel Blondel% Done:

100%

Category:Application
Sprint:UnSprintable
Infrastructure:Production
Milestones:
Duration:

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.

http://workspace-repository.d4science.org:8080/rest/GetPublicLink?absPath=/Home/emmanuel.blondel/Workspace/mpa-web.zip

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

test.zip (1.89 MB) Emmanuel Blondel, Feb 15, 2017 04:30 PM


Subtasks

Task #7150: Add cURL examples to HL Rest API wikiClosedValentina Marioli


Related issues

Related to BlueBRIDGE - Project Activity #5828: Evaluate feasibly to publish Spatialite layer in GeoServe... Closed Dec 02, 2016
Related to BlueBRIDGE - Project Task #687: T9.1 Data Storage, Discovery and Access [Months: 1-29] Closed Oct 19, 2015 Oct 13, 2017

History

#2 Updated by Roberto Cirillo almost 3 years ago

  • Assignee set to Valentina Marioli
  • Category set to Application

#3 Updated by Valentina Marioli almost 3 years ago

  • Status changed from New to In Progress

#4 Updated by Emmanuel Blondel almost 3 years ago

  • Related to Project Activity #5828: Evaluate feasibly to publish Spatialite layer in GeoServer with existing tools added

#5 Updated by Valentina Marioli almost 3 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.

#6 Updated by Valentina Marioli almost 3 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.

#7 Updated by Emmanuel Blondel almost 3 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

#8 Updated by Emmanuel Blondel almost 3 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

#9 Updated by Valentina Marioli almost 3 years ago

  • % Done changed from 0 to 50
  • Priority changed from High to Normal
  • Tracker changed from Support to Task

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.

#10 Updated by Valentina Marioli almost 3 years ago

  • Assignee changed from Valentina Marioli to Emmanuel Blondel
  • Status changed from In Progress to Feedback

#11 Updated by Emmanuel Blondel almost 3 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.

#12 Updated by Valentina Marioli over 2 years ago

  • Related to Project Task #687: T9.1 Data Storage, Discovery and Access [Months: 1-29] added

Also available in: Atom PDF