HDFGroup / h5serv

Reference service implementation of the HDF5 REST API
Other
168 stars 35 forks source link

POST value #113

Closed shwetagopaul92 closed 7 years ago

shwetagopaul92 commented 7 years ago

I am trying to use the RESTful API for POST Value with the app called POSTMAN. I have attached the screenshots of the request I tried for a hdf server running on an aws instance with ip : 54.163.220.201:5000. The image shows the headers and the body of the request used.

screen shot 2017-04-21 at 12 44 09 pm

screen shot 2017-04-21 at 12 44 20 pm

The request keeps loading and never returns a response. Is there something that should be different in my request?

Thank you!

jreadey commented 7 years ago

I haven't tried out POSTMAN yet. Can you provide an equivalent curl request that demonstrates the problem?

shwetagopaul92 commented 7 years ago

A curl request would be curl -H "Content-Length:92" -H "User-Agent:python-requests/2.3.0 CPython/2.7.8 Darwin/14.0.0" -H "host:tall.test.hdfgroup.org" -H "Accept:/" -H "Accept-Encoding:gzip, deflate" -X POST http://54.163.220.201:5000/datasets/4e83ad1c-ab6e-11e4-babb-3c15c2da029e/value -d {"points": [19, 17, 13, 11, 7, 5, 3, 2]}

This is similar to the request format given on : http://h5serv.readthedocs.io/en/latest/DatasetOps/POST_Value.html

jreadey commented 7 years ago

I'm able to curl using the tall.h5 file:

$ curl -H "host:tall.test.hdfgroup.org" -X POST http://127.0.0.1:5000/datasets/862165c0-06b6-11e7-a392-3c15c2da029e/value -d '{"points":[3,4,5,2]}'
{"value": [3, 4, 5, 2]}

The UUID would be different for your installation, but it's the dset1.1.2 dataset in the g1.1 group. Note you need to be quotes around the body in the curl request.

Also the extra header lines aren't needed. By default h5serv assumes JSON input and will give JSON output.

shwetagopaul92 commented 7 years ago

Thank you for checking this out! I did try it out with the UUID for my installation.

screen shot 2017-04-25 at 10 48 58 am

The UUID is: 89e5526b-0fdb-11e7-9992-12d1ec5e67fe

However, when I try the curl command,

screen shot 2017-04-25 at 10 50 44 am

I get a HTTP 410 error saying the dataset with uuid has been previously deleted. This seems to happen for any dataset I try to use a POST request with. A GET request to the server running on this IP using CURL or postman does work. Would there be any specific reason for this?

jreadey commented 7 years ago

That seems really odd. Can you send me the tall.h5 file from the server data directory? I can experiment on my side.

shwetagopaul92 commented 7 years ago

Yes, I could email this to you. Would this email address work : jreadey@hdfgroup.org ?

shwetagopaul92 commented 7 years ago

I believe this was because the UUID used was of the file's group and not of the dataset's!
With the dataset id, this works perfectly fine.

screen shot 2017-04-25 at 3 43 39 pm

jreadey commented 7 years ago

I got your file, but hadn't had time to look at it yet. Are you good to go now?

shwetagopaul92 commented 7 years ago

yes, thank you!

jreadey commented 7 years ago

Ok, great!