Team:HFUT-China/Api

BioDesigner Coral API

API Document

Universe

  1. All interface responses are based on the JSON data format.

  2. Each response contains the following fixed fields: successful indicates whether the request succeeds or not (true indicates a successful validation and false indicates an unsuccessful validation). If the request fails, there will be an error field, which indicates the error number and the specific information.the following content will be automatically included in the response, so it will not repeat in the document.

    {
        "successful": succeed or not,
        "error": {
            "id": error number,
            "message": error message
        }
    }
            

Accounts

User Register
    URL: /accounts/register
    METHOD: POST
    REQUEST CONTENT: 
    {
        "username": user name,
        "password": user password,
        "repassword": user password,
        "email": user email
    }
    RESPONSE CONTENT: None
            
User Login
    URL: /accounts/login
    METHOD: POST
    REQUEST CONTENT: 
    {
        "username": user name,
        "password": user password,
    }
    RESPONSE CONTENT:
    {
        "confirmed": confirmed or not,
        "token": User Token,
    }
            
Change Password
    URL: /accounts/ changePassword
    METHOD: POST
    REQUEST CONTENT: 
    {
        "username": user name,
        "password": user password,
    }
    RESPONSE CONTENT:
    {
        "confirmed": confirmed or not,
        "token": User Token,
    }
            
User Logout
    URL: /accounts/ logout
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
    }
    RESPONSE CONTENT: None
            

Design

Get Chain
    URL: /design/getChain
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "project_id": project id,
        "chain_id": chain id,
    }
    RESPONSE CONTENT:
    {
        "partList": {
            "part_id": part id,
            "part_name": part_name,
            "part_type": part type
        }
    }
            
Search Parts
    URL: /design/searchParts
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "keyword": keyword of search,
        "funcs": functions
    }
    RESPONSE CONTENT:
    {
        "searchResult": {
            "part_name": part name,
            "part_id": part id,
            "part_type": part type,
        }
    }

            
Get Parts
    URL: /design/ getParts
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "part_name": part name,
    }
    RESPONSE CONTENT:
    {
        "SearchResult": {
            "part_id": part id,
            "ok": ok,
            "part_name": part name,
            "nickname" : nickname,
            "short_desc": short desc,
            "description": description,
            "part_type": part type,
            "author": author,
            "status": status,
            "dominant": dominant,
            "discontinued": discontinued,
            "part_status": part status,
            "sample_status": sample status,
            "p_status_cache": p status cache,
            "s_status_cache": s status cache,
            "in_stock": in stock,
            "results": results,
            "favorite": favorite,
            "ps_string": ps string,
            "scars": scars,
            "barcode": barcode,
            "notes": notes,
            "source": source,
            "premium": premium,
            "categories": categories,
            "sequence": sequence,
            "sequence_length": sequence length,
            "part_url": part url,
            "score": score
        }
    }
            
Update Chain
    URL: /design/ updateChain
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "project_id": project id,
        "chain_id": chain id,
        "chain_info": chain info
    }
    RESPONSE CONTENT:
    {
        "seq": sequence
    }
            
Get Markov Recommend
    URL: /design/ getMRecommend
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "part_id": part id,
    }
    RESPONSE CONTENT:
    {
        "recommend_list": {
            "part_name": part name,
            "part_id": part id,
            "part_type": part type,
        }
    }
            
Get Before Recommend
    URL: /design/ getBeforeRecommend
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "part_id": part id,
    }
    RESPONSE CONTENT:
    {
        "recommend_list": {
            "part_name": part name,
            "part_id": part id,
            "part_type": part type,
        }
    }
            
Get Bettwen Recommend
    URL: /design/ getBettwenRecommend
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
    "part_id_one": part id one,
    "part_id_two": part id two,
    }
    RESPONSE CONTENT:
    {
        "recommend_list": {
            "part_name": part name,
            "part_id": part id,
            "part_type": part type,
        }
    }
            
Get Result Image
    URL: /design/ getResultImage
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "project_id": project id,
        "chain_id": chain id,
    }   
    RESPONSE CONTENT:
    {
        "filepath": the image path,
    }
            

GeneRealationShip

Search Genes
    URL: /geneRealationShip/searchGenes
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "keyword": keyword,
    }
    RESPONSE CONTENT:
    {
        "search_result": {
            "gene_name": gene name
        }
    }
            
Random Gene
    URL: / geneRealationShip /randomGene
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
    }
    RESPONSE CONTENT:
    {
        "search_result": {
            "name": main gene name,
            "children": realted gene
        }
    }
            
Related Gene
    URL: / geneRealationShip/ getRelatedGene
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "gene_name": gene name,
    }
    RESPONSE CONTENT:
    {
        "search_result": {
            "name": main gene name,
            "children": realted gene
        }
    }
            
Gene Info
    URL: /geneRelationShip/ getGeneInfo
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "gene_name": gene name,
    }
    RESPONSE CONTENT:
    {
        "get_result": {
            "gene_id": gene id,
            "name": gene name,
            "definition": gene definition,
            "organism_short": gene organism short,
            "organism": gene organism,
            "gene_url": gene url
        }
    }
            
Related Paper
    URL: /geneRelationShip/ getRelatedPaper
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "gene_name": gene name,
    }
    RESPONSE CONTENT:
    {
        "realated_paper_list": {
            "paper_id": paper id,
            "paper_title": paper title,
            "paper_link": paper link,
            "paper_keyword": paper keyword,
            "paper_abstract": paper abstract,
        }
    }
            

Project Manage

User Project
    URL: /home/getUserProject
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
    }
    RESPONSE CONTENT:
    {
        "track": track name,
        "project_id": project id,
        "project_name": project name,
        "function": function,
        "creator": user name,
    }
            
Project Devices
    URL: / home /getProjectDevices
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "project_id": project id
    }
    RESPONSE CONTENT:
    {
        "chain_sequence": chain sequence,
        "chain_name": chain name,
        "chain_id": chain id,
        "chain_image_file_path": image path,
        "chain_length": chain length,
        "chain_isModified": true or false
    }
            
Get Tracks
    URL: / home/ getTracks
    METHOD: POST
    REQUEST CONTENT: 
    None
    RESPONSE CONTENT:
    {
        "track_id": track id,
        "track_name": track name,
    }
            
Create New Project
    URL: /home/ createNewProject
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "project_name": project name,
        "track": track name
    }
    RESPONSE CONTENT: None
            
Delete Project
    URL: /home/ deleteProject
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "project_id": project id,
    }
    RESPONSE CONTENT:None
            
Create Project Device
    URL: /home/ createProjectDevice
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "project_id": project id,
        "device_name": device name
    }
    RESPONSE CONTENT: None
            
Delete Project Device
    URL: /home/ deleteProjectDevice
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "project_id": project id,
        "chain_id": chain id,
    }
    RESPONSE CONTENT: None
            

System

Search Compound
    URL: /system/searchCompound
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "keyword": keyword
    }
    RESPONSE CONTENT:
    {
        "compound_id": compound id,
        "name": compound name
    }
            
Get Compound
    URL: / system /getCompound
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "compound_id": compound id
    }
    RESPONSE CONTENT:
    {
        "name": compound name,
        "nicknames": nick name,
        "mol_weight": weight,
        "exact_mass": mass,
        "formula": formula
    }
            
Get Gene
    URL: /system/ getGene
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token":    User Token,
        "gene id": gene id,
    }
    RESPONSE CONTENT:
    {
        "gene_id": gene id,
        "name": gene name,
        "definition": gene definition,
        "organism_short": gene organism short,
        "organism": gene organism,
        "gene_url": gene url
    }
            
Get Related Compound
    URL: /system/ getRelatedCompound
    METHOD: POST
    REQUEST CONTENT: 
    {
        "token": User Token,
        "compound_tags": {
                "name": compound name,
                "id": compound id,
        }
    }
    RESPONSE CONTENT:
    {
        "nodes": {
            "name": compound name,
            "id": compound id,
        }
        "edges": {
            "source": source,
            "relation": relation number,
            "target": target
        }
    }