Endpoints:

1. /createKG:
Generates a Knowledge Graph based on disease ID, clinical trial phase, and protein threshold.
1.1 Input Format:
                {
                    "disease_id": "MONDO_0004976",
                    "clinical_trial_phase": 3,
                    "protein_threshold": 0.8
                }
                
1.2 Output Format:
                {
                    "disease_id": "MONDO_0004976",
                    "clinical_trial_phase": 3,
                    "protein_threshold": 0.8,
                    "created_kg": { ... }  # JGIF JSON format of the generated Knowledge Graph. Please look at PyBel documentation (pybel.from_jgif_json) for more details on how to parse this format.,
                    "limit_info": None | str      # Dependability issues from other APIs.
                }
                
2. /getDiseaseIDs:
Returns available disease IDs from a given disease name.
2.1 Input Format:
                {
                    "disease_name": "cancer"
                }
                
2.2 Output Format:
                {
                    "disease_name": "cancer"
                    "disease_ids": A list of dictionary containing disease IDs and other information.
                }
                

Authentication

First you need to get a token by calling the /request_token endpoint with your username and password.
(To get the username and password, please contact Fraunhofer ITMP). Once you have a username and a password, you can generate token for APIs in following way in python:

        import requests

        response = requests.post("http://10.164.197.141:8080/request_token", data={"username": "YOUR_USERNAME", "password": "YOUR_PASSWORD"})
        token = response.json().get("access_token")
        

Now you can use this token in the Authorization header as a Bearer token for all other endpoints.

Example of using the token in python:

        headers = {"Authorization": f"Bearer {token}"}
        response = requests.post("http://10.164.197.141:8080/createKG", json={"disease_id": "MONDO_0004976", "clinical_trial_phase": 3, "protein_threshold": 0.8}, headers=headers)
        print(response.json())
        
Please follow this same format for all other endpoints that might need authentication!