summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2016-09-07 10:51:23 +0200
committerrautenberg <rautenberg@in-silico.ch>2016-09-07 10:51:23 +0200
commit7e052d246daa76b178b1ad6199743f9d16d9ad30 (patch)
treed774000be9ca19e0107c4ad4905488a59b1729b7
parent1099a6c50d2ca000787b838e45016ed63df0ae9f (diff)
fix swagger content-type, replace with correct accept
-rw-r--r--api/api.json39
-rw-r--r--lib/dataset.rb2
2 files changed, 15 insertions, 26 deletions
diff --git a/api/api.json b/api/api.json
index 7033ad3..abc4a0b 100644
--- a/api/api.json
+++ b/api/api.json
@@ -70,9 +70,9 @@
"description": "Get model representation",
"parameters": [
{
- "name": "Content-Type",
+ "name": "accept",
"in": "header",
- "description": "body Content-Type",
+ "description": "requested Content-Type",
"required": true,
"type": "string",
"enum": [
@@ -193,25 +193,14 @@
"description": "Get dataset representation",
"parameters": [
{
- "name": "Content-Type",
- "in": "header",
- "description": "body Content-Type",
- "required": true,
- "type": "string",
- "enum": [
- "application/json",
- "text/csv"
- ]
- },
- {
"name": "accept",
"in": "header",
"description": "requested Content-Type",
"required": true,
"type": "string",
"enum": [
- "text/uri-list",
- "application/json"
+ "application/json",
+ "text/csv"
]
},
{
@@ -249,9 +238,9 @@
"description": "Get dataset representation",
"parameters": [
{
- "name": "Content-Type",
+ "name": "accept",
"in": "header",
- "description": "body Content-Type",
+ "description": "requested Content-Type",
"required": true,
"type": "string",
"enum": [
@@ -347,9 +336,9 @@
"description": "Get substance representation",
"parameters": [
{
- "name": "Content-Type",
+ "name": "accept",
"in": "header",
- "description": "body Content-Type",
+ "description": "requested Content-Type",
"required": true,
"type": "string",
"enum": [
@@ -432,9 +421,9 @@
"description": "Get nanoparticle representation",
"parameters": [
{
- "name": "Content-Type",
+ "name": "accept",
"in": "header",
- "description": "body Content-Type",
+ "description": "requested Content-Type",
"required": true,
"type": "string",
"enum": [
@@ -517,9 +506,9 @@
"description": "Get feature representation",
"parameters": [
{
- "name": "Content-Type",
+ "name": "acept",
"in": "header",
- "description": "body Content-Type",
+ "description": "requested Content-Type",
"required": true,
"type": "string",
"enum": [
@@ -742,7 +731,7 @@
"required": true,
"type": "string",
"enum": [
- "application/csv",
+ "text/csv",
"application/json"
]
},
@@ -765,7 +754,7 @@
}
],
"produces": [
- "application/csv",
+ "text/csv",
"application/json"
],
"responses": {
diff --git a/lib/dataset.rb b/lib/dataset.rb
index 1468c8d..a48b23f 100644
--- a/lib/dataset.rb
+++ b/lib/dataset.rb
@@ -29,7 +29,7 @@ get "/dataset/:id/?" do
dataset[:substances] = uri("/dataset/#{dataset.id}/substances")
dataset[:features] = uri("/dataset/#{dataset.id}/features")
return dataset.to_json
- when "text/csv"
+ when "text/csv", "application/csv"
return dataset.to_csv
else
bad_request_error "Mime type #{@accept} is not supported."