Home
/

API

API Documentation

This document provides the information you need to interact with the TROPIC Database programmatically. You can use the REST API directly or our convenient Python client.

Data Models

The API returns data structured according to the following models. The primary model is Reaction, which contains several nested data objects.

REST API Usage

You can interact with the database by making HTTP requests to the REST API endpoints. The base URL for the API is https://api.polytropic.org.

Querying Reactions

The main endpoint for retrieving data is /reactions. You can filter the results by appending query parameters to the URL. Nested fields are accessed using a double underscore (__).

Example Request:
curl -X 'GET' 'https://api.polytropic.org/reactions?parameters__is_experimental=true&monomer__ring_size__gte=5' -H 'accept: application/json'
Common Filter Parameters:
ParameterDescription
reaction_idFilter by a specific reaction ID.
typeFilter by reaction type (e.g., ROP, ROR).
monomer__ring_size__gteFilter by monomer ring size (greater than or equal to).
monomer__molecular_weight__lteFilter by monomer molecular weight (less than or equal to).
parameters__is_experimentalFilter by experimental (true) or computational (false) data.
parameters__method__inFilter by one or more methods (e.g., dft, dsc).
thermo__delta_h__gteFilter by enthalpy of polymerization.
metadata__year__gteFilter by publication year.

Python Client

For Python users, we provide a simple client library that handles API requests and data parsing for you.

Installation

pip install tropic-client

Usage Example

from tropic.client import TropicClient

with TropicClient() as client:
    # Find all ROR reactions with a monomer ring size >= 10
    reactions = client.get_reactions(
        type="ROR",
        monomer__ring_size__gte=10
    )

    for reaction in reactions:
        print(reaction.reaction_id, reaction.thermo.delta_h)