cytoscape / cyREST

Core App: REST API module for Cytoscape
https://github.com/cytoscape/cyREST/wiki
MIT License
30 stars 13 forks source link

Endpoint "/v1/commands/network/create empty" fails with "application/xml" (offered in Swagger) #55

Closed krassowski closed 6 years ago

krassowski commented 6 years ago

Here is the generated curl command:

curl -X POST --header 'Content-Type: application/xml' --header 'Accept: text/html' 'http://localhost:1234/v1/commands/network/create empty'

And here is the error:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 415 Unsupported Media Type</title>
</head>
<body><h2>HTTP ERROR 415</h2>
<p>Problem accessing /v1/commands/network/create%20empty. Reason:
<pre>    Unsupported Media Type</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                

</body>
</html>

It works fine with "application/json".

dotasek commented 6 years ago

Try replacing your spaces with %20

Spaces are usually handled automatically within web browsers, but not so in the console.

I can confirm the following works on my setup:

curl -X POST --header 'Content-Type: applicaion/json' --header 'Accept: application/json' -d '{}' 'http://localhost:3334/v1/commands/network/create%20empty'

krassowski commented 6 years ago

I am sorry but I think that you are wrong. It's not a space or curl issue - no duplicates here ;)

Please have a look at my recording (25 sec): ezgif-2-1936c52ce1

Also your confirmation shows curl with application/json, not with application/xml.

bdemchak commented 6 years ago

Jumping in here ... @krassowski: Thanks for all of your excellent help. We are getting lots of valuable feedback.

Barry Demchak -- from my mobile phone

On Feb 27, 2018 11:43 AM, "krassowski" notifications@github.com wrote:

I am sorry but I think that you are wrong. It's not a space or curl issue - no duplicates here ;)

Please have a look at my recording (25 sec): [image: ezgif-2-1936c52ce1] https://user-images.githubusercontent.com/5832902/36744749-daedebf8-1bed-11e8-9133-09838d14e541.gif

Also your confirmation shows curl with application/json, not with application/xml.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cytoscape/cyREST/issues/55#issuecomment-368963760, or mute the thread https://github.com/notifications/unsubscribe-auth/ADhl3m1xF0xreMKxOz-tZQwv-zG9F2E4ks5tZD7CgaJpZM4SUtxL .

dotasek commented 6 years ago

Ah, I missed the detail of 'Content-Type: application/xml' specification. Thanks for being insistent. I'll take a look and see if I can disable xml content type for the Swagger documentation.

dotasek commented 6 years ago

Addressed in 87063b3da36097b82025eec0049676bb86794966

Awaiting release.