REST API

The purpose of this API is to prefetch the safety index and possible risks of a drug therapy. Based on the results the end user should than decide to open the provided link in the browser for more details. The documenation is only available in English and we used javascript for the examples, but the request should be very similar in other languages.

Endpoint

Meta

To keep things simple the api response will always have a status code of 200. In the meta object of the result the codes are more specific.

Code Status Message Reason
201 Created Review created Request successfull
202 Accepted Parsing of payload incomplete Payload could only be parsed partially
204 No content No drugs available Payload was empty
400 Bad Request Language xx is not available Available lanugages are [“en”,”de”,”fr”,”it”,”es”]
400 Bad Request Payload is not an array Payload must be an array
400 Bad Request Unknown Unexpected error
413 Payload to large Reduce the number of drugs Currently only 10 drugs are allowed

Payload

Currently Swiss gtins and the name of the substance are parsed. One one of the fields should be provided.

Prefetch two substances with gtin

Request

const result = await fetch(`https://api.epha.health/clinic/advice/en/`, {
  method: "POST",
  headers: {
    "content-type": "application/json"
  },
  body: JSON.stringify([
    { type: "drug", gtin: "7680490590439" },
    { type: "drug", gtin: "7680582930167" }
  ])
}).then(res => res.json());

Response

{
  "meta": {
    "code": 201,
    "status": "Created",
    "message": "Review created"
  },
  "data": {
    "id": "a773-60ae-c5d3-660b-4546",
    "link": "https://epha.health/clinic/advice/de/xid=a773-60ae-c5d3-660b-4546/",
    "safety": 84,
    "risk": {
      "kinetic": 1,
      "qtc": 1,
      "warning": 3,
      "serotonerg": 0,
      "anticholinergic": 0,
      "adverse": 11
    },
    "valid": [
      {
        "type": "drug",
        "gtin": "7680490590439"
      },
      {
        "type": "drug",
        "gtin": "7680582930167"
      }
    ],
    "fails": []
  }
}

Prefetch two substances incomplete

From the two substance only one drug can be parsed

Request

const result = await fetch(`https://api.epha.health/clinic/advice/en/`, {
  method: "POST",
  headers: {
    "content-type": "application/json"
  },
  body: JSON.stringify([
    { type: "drug", name: "Aripiprazol" },
    { type: "drug", gtin: "7680582930" }
  ])
}).then(res => res.json());

Response

{
  "meta": {
    "code": 202,
    "status": "Accepted",
    "message": "Parsing of payload incomplete"
  },
  "data": {
    "id": "25a0-5cc2-07bb-68b0-d046",
    "link": "https://epha.health/clinic/advice/en/xid=25a0-5cc2-07bb-68b0-d046/",
    "safety": 85,
    "risk": {
      "kinetic": 1,
      "qtc": 1,
      "warning": 3,
      "serotonerg": 0,
      "anticholinergic": 2,
      "adverse": 8
    },
    "valid": [
      {
        "type": "drug",
        "name": "Aripiprazol"
      }
    ],
    "fails": [
      {
        "type": "drug",
        "gtin": "7680582930"
      }
    ]
  }
}