Design/Api_v1.0

Drugle API v 1.0

This is the specification document of the Drugle v1.0 API.

Operations

This section describes the complete set of services in Drugle API. Each operation is specified as a REST resource and its URI is relative to a root URI that we denote by <drugle-root>. E.g.: <drugle-root> = http://drugledemo.seibostudios.se

OperationDescription
SearchProcess the search and returns a search id to access the results.
ResultsThe results of the query specified in the <query-id> parameter represented as JSON.
Document SectionThe section content of a specific document.
TermsThe list of terms starting with the prefix <term-prefix> specified in the parameters.
DocumentThe document <document-id> in <fmt> representation.

Process the search and returns a search id to access the results.

HTTP Method

POST

Uri

<drugle-root>/api/1_0/query

Body

{
    query: “<query_text>”,
    language: “<language>”,
    aspect: “<aspect>”,
    profile: “<profile>”
}
  • query: <string>
    the text to search for
  • language: [all | de | en | es | fr | sv]
    specifies the documents language:
    • all: any language
    • de: German
    • en: English
    • es: Spanish
    • fr: French
    • sv: Swedish
  • aspect: [ all | 1 | 2 | 3 | 4.1 | 4.2 | 4.3 | 4.5 | 4.8 ]
    specifies the documents aspect to search for:
    • all: any aspect
    • 1: Medicinal product name
    • 2: Quantitative composition
    • 3: Pharmaceutical form
    • 4.1: Therapeutic indications
    • 4.2: Posology
    • 4.3: Contraindications
    • 4.5: Interactions
    • 4.8: Undesirable effects
  • profile: [ profile-normal | profile-doctor]
    user profile used to order the results

Response body

<search-id>

  • search-id: INTEGER
    The search id used to access the results.

Errors

To Do

Example

To Do

Results

Description

Returns a JSON document with the results of the query specified in the <query_id> parameter.

HTTP Method

GET

Uri

<drugle-root>/api/1_0/query/<query_id>/<offset>/<limit>

  • query_id: <integer>
    the search number that identifies the previous created search
  • offset: <integer>
    the starting result number to retrieve
  • limit: <integer>
    the results quantity to retrieve, offset and limit are used to implement pagination

Body

None

Response body

Returns a JSON document with the results of the <query_id> query, paging the results according to the offset and limit parameters:

{
    query: “<query_text>”,
    language: “<language>”,
    aspect: “<aspect>”,
    profile: “<profile>”,
    total_results: “<integer>”,
    time_measure: “<float>”,
    total_searches: “integer”,
    results: [ {id: “<id>”, title: “<title>”, section_id: “<section_id>”, section_name: “<section_name>”, section_abstract: “<section_abstract>”, link: “<link>”,  source_link: “<source_link>”, text_link: “<text_link>”, original_link: “<original_link>”, hosted_link: “<hosted_link>”}, ...
             ]
}

Errors

To Do

Example

To Do

Document section

Description

Returns the specified section/aspect of a Document.

HTTP Method

GET

Uri

<drugle-root>/api/1_0/documents/<document_id>/<section_id>

  • document_id: STRING
    the document id
  • section_id: [ 1 | 2 | 3 | 4.1 | 4.2 | 4.3 | 4.5 | 4.8 ]
    specifies the document section/aspect to retrieve

Body

None

Response body

To Do

Errors

To Do

Example

To Do

Terms

Description

Returns a list of terms starting with the prefix <term_prefix> specified in the parameters.

HTTP Method

GET

Uri

<drugle-root>/api/1_0/terms/<term_prefix>

  • term_prefix: STRING
    the prefix string of the terms to retrieve

Body

None

Response body

Returns a JSON document containing a list of string elements:

 ['term_1', 'term_2', ... 'term_n']

Errors

None

Example

In this example we replace the test() function of the search operation to retrieve a list of terms that matches with the sent prefix

function test() {
  var prefix = "asp";

  url = "/drugle-root/terms/" + prefix;
  client.open ('POST', url, true);
  client.onreadystatechange = handler;
  client.send (text);
}

Document

Description

The document <document_id> in <fmt> representation

HTTP Method

GET

Uri

<drugle-root>/api/1_0/resources/<document_id>/<type>

  • type: [ pdf | txt ]
    the file type
  • document_id: STRING
    the id of the document file to download

Body

None

Response body

Returns a document with content type "application/pdf" or "text/plain".

Errors

None

Example

A text file link example: <drugle-root>/api/1_0/resources/39489382/txt
A pdf file link example: <drugle-root>/api/1_0/resources/23897493/pdf