Skip to content

Latest commit

 

History

History
162 lines (137 loc) · 5.42 KB

File metadata and controls

162 lines (137 loc) · 5.42 KB

Overview

Introduction

The Resources Information Network (RIN) APIs are provided via an ElasticSearch endpoint.

Access to the RIN APIs

Access to the RIN API is provided via an Elasticsearch pass-through.

{% swagger method="post" path="" baseUrl="https://scicrunch.org/api/1/elastic//_search?api_key=####" summary="General Elasticsearch" %} {% swagger-description %} The pass-through is accessible at https://scicrunch.org/api/1/elastic. Similar to standard Elasticsearch APIs you must then supply an index and an action. In this case the index, the type and the search command (_search).

\

\

Documentation on the Elasticsearch Search API is available at https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search.html {% endswagger-description %}

{% swagger-parameter in="path" name="index" required="true" %} Production RIN indices {% endswagger-parameter %}

{% swagger-parameter in="path" name="api_key" required="true" %} Your API key to access the services {% endswagger-parameter %}

{% swagger-response status="200: OK" description="" %}

{
    "took": 23,
    "timed_out": false,
    "_shards": {
        "total": 2,
        "successful": 2,
        "skipped": 0,
        "failed": 0
    },
    "hits": {...}
}

{% endswagger-response %}

{% swagger-response status="400: Bad Request" description="the api key is incorrect" %}

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "request [/RIN_Addgene_pr/rin/_search] contains unrecognized parameter: [api_key]"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "request [/RIN_Addgene_pr/rin/_search] contains unrecognized parameter: [api_key]"
    },
    "status": 400
}

{% endswagger-response %}

{% swagger-response status="401: Unauthorized" description="such as "no api key"" %}

{
    "error": {
        "root_cause": [
            {
                "type": "security_exception",
                "reason": "action [indices:data/read/search] requires authentication",
                "header": {
                    "WWW-Authenticate": [
                        "Bearer realm=\"security\"",
                        "ApiKey",
                        "Basic realm=\"security\" charset=\"UTF-8\""
                    ]
                }
            }
        ],
        "type": "security_exception",
        "reason": "action [indices:data/read/search] requires authentication",
        "header": {
            "WWW-Authenticate": [
                "Bearer realm=\"security\"",
                "ApiKey",
                "Basic realm=\"security\" charset=\"UTF-8\""
            ]
        }
    },
    "status": 401
}

{% endswagger-response %}

{% swagger-response status="404: Not Found" description="the index or the server uri is incorrect" %}

{
    "error": {
        "root_cause": [
            {
                "type": "index_not_found_exception",
                "reason": "no such index",
                "resource.type": "index_or_alias",
                "resource.id": "RIN_Addgene",
                "index_uuid": "_na_",
                "index": "RIN_Addgene"
            }
        ],
        "type": "index_not_found_exception",
        "reason": "no such index",
        "resource.type": "index_or_alias",
        "resource.id": "RIN_Addgene",
        "index_uuid": "_na_",
        "index": "RIN_Addgene"
    },
    "status": 404
}

{% endswagger-response %}

{% swagger-response status="500: Internal Server Error" description="the query is incorrect" %}

{
    "error": {
        "root_cause": [
            {
                "type": "json_parse_exception",
                "reason": "Unexpected character ('=' (code 61)): was expecting a colon to separate field name and value\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@4eccf1fd; line: 5, column: 25]"
            }
        ],
        "type": "json_parse_exception",
        "reason": "Unexpected character ('=' (code 61)): was expecting a colon to separate field name and value\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@4eccf1fd; line: 5, column: 25]"
    },
    "status": 500
}

{% endswagger-response %} {% endswagger %}

RIN indices

Management of indices is accomplished via Elasticsearch aliases. The index aliases are provided:

Index Alias Description
RIN_Tool_pr Production tools index
RIN_Antibody_pr Production antibodies index
RIN_CellLine_pr Production cell lines index
RIN_Organism_pr Production organisms index
RIN_Addgene_pr,RIN_DGRC_*_pr Production plasmids (AddGene & DGRC) indices
RIN_BioSample_pr Production biosamples index
RIN_Protocols_pr Production protocols index
*_pr Production all indices

Using aliases will allow for testing on updates and enhancements to the index structure. If needed additional aliases can be constructed for specialized testing.