Skip to content
Snippets Groups Projects
Commit 8dd3712f authored by Justin Ehlert's avatar Justin Ehlert
Browse files

Add API documentation for search endpoint

parent 1f9ce5be
No related branches found
No related tags found
No related merge requests found
......@@ -175,6 +175,7 @@ expected_input_schemas = set([
'propose-batch.json',
'rule-new.json',
'rule-update.json',
'search-query.json',
'session.json',
'session-update.json',
'subject.json',
......
......@@ -68,6 +68,7 @@ paths:
- paths/batch.yaml
- paths/analyses.yaml
- paths/site-rules.yaml
- paths/dataexplorer.yaml
securityDefinitions:
......
/dataexplorer/search:
post:
summary: Perform a search query
operationId: search
parameters:
- name: simple
in: query
type: boolean
- name: limit
in: query
type: integer
- name: body
in: body
required: true
schema:
$ref: schemas/input/search-query.json
responses:
'200':
description: A list of results of the search query
schema:
$ref: schemas/output/search-response-list.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"search-type": {
"type": "string",
"enum": ["file", "acquisition", "session", "analysis", "collection"],
"description": "Sets the type of search results to return"
},
"search-query": {
"type": "object",
"properties": {
"return_type": {"$ref": "#/definitions/search-type"},
"search_string": {
"type": "string",
"description": "Represents the plain text search query"
},
"all_data": {
"type": "boolean",
"description": "When set will include all data that the user does not have access to read",
"default": false
},
"filters": {
"type": "object",
"description": "See https://www.elastic.co/guide/en/elasticsearch/reference/current/term-level-queries.html"
}
},
"required": ["return_type"]
},
"search-project-response": {
"type": "object",
"properties": {
"_id": {"$ref":"container.json#/definitions/_id"},
"label": {"$ref":"common.json#/definitions/label"}
},
"description": "Fields for project search response"
},
"search-group-response": {
"type": "object",
"properties": {
"_id": {"$ref":"container.json#/definitions/_id"},
"label": {"$ref":"common.json#/definitions/label"}
},
"description": "Fields for group search response"
},
"search-session-response": {
"type": "object",
"properties": {
"_id": {"$ref":"container.json#/definitions/_id"},
"label": {"$ref":"common.json#/definitions/label"},
"timestamp": {"$ref":"common.json#/definitions/timestamp"},
"created": {"$ref":"created-modified.json#/definitions/created"}
},
"description": "Fields for session search response"
},
"search-acquisition-response": {
"type": "object",
"properties": {
"_id": {"$ref":"container.json#/definitions/_id"},
"label": {"$ref":"common.json#/definitions/label"},
"timestamp": {"$ref":"common.json#/definitions/timestamp"},
"created": {"$ref":"created-modified.json#/definitions/created"}
},
"description": "Fields for acquisition search response"
},
"search-subject-response": {
"type": "object",
"properties": {
"code": {"$ref":"subject.json#/definitions/code"}
},
"description": "Fields for subject search response"
},
"search-file-response": {
"type": "object",
"properties": {
"measurements": {"$ref":"file.json#/definitions/measurements"},
"created": {"$ref":"created-modified.json#/definitions/created"},
"type": {"$ref":"file.json#/definitions/file-type"},
"name": {"$ref":"file.json#/definitions/name"},
"size": {"$ref":"file.json#/definitions/size"}
},
"description": "Fields for file search response"
},
"search-analysis-response": {
"type": "object",
"properties": {
"_id": {"$ref":"container.json#/definitions/_id"},
"label": {"$ref":"common.json#/definitions/label"},
"user": {"$ref":"common.json#/definitions/user-id"},
"created": {"$ref":"created-modified.json#/definitions/created"}
},
"description": "Fields for acquisition search response"
},
"search-parent-response": {
"type": "object",
"properties": {
"_id": {"$ref":"container.json#/definitions/_id"},
"type": {"$ref":"container.json#/definitions/container-type"}
},
"description": "Fields for parent search response"
},
"search-collection-response": {
"type": "object",
"properties": {
"_id": {"$ref":"container.json#/definitions/_id"},
"label": {"$ref":"common.json#/definitions/label"},
"curator": {"$ref":"common.json#/definitions/user-id"},
"created": {"$ref":"created-modified.json#/definitions/created"}
},
"description": "Fields for collection search response"
},
"search-response": {
"type": "object",
"properties": {
"project": {"$ref":"#/definitions/search-project-response"},
"group": {"$ref":"#/definitions/search-group-response"},
"session": {"$ref":"#/definitions/search-session-response"},
"acquisition": {"$ref":"#/definitions/search-acquisition-response"},
"subject": {"$ref":"#/definitions/search-subject-response"},
"file": {"$ref":"#/definitions/search-file-response"},
"collection": {"$ref":"#/definitions/search-collection-response"},
"analysis": {"$ref":"#/definitions/search-analysis-response"},
"parent": {"$ref":"#/definitions/search-parent-response"},
"permissions": {"$ref":"permission.json#/definitions/permission-output-list"}
},
"description": "Single search response entry"
}
}
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"allOf":[{"$ref":"../definitions/search.json#/definitions/search-query"}],
"example": {
"return_type": "session",
"search_string": "amyg"
}
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {"$ref":"../definitions/search.json#/definitions/search-response"},
"example": []
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment