Loading
/custom-emojis/emojis/contour-map.png
Templates
📚
Articles & Resources
📖
Guides & Support
🌵
CalcTree
Bust Common Myths About Java Programming
Loading
/custom-emojis/emojis/calculator.png
Tensile Strength and Capacity Control of the W-Shape Sections According to AISC 360-16
Estados de Vigas de Concreto
Loading
/custom-emojis/emojis/calculator.png
Concrete Cylinder Strength Vs Cube Strength
Loading
/custom-emojis/emojis/calculator.png
Earthquake Design Action Calculation
Sıvılaşma Verileri Tablosu
Loading
/custom-emojis/emojis/rc-beam.png
Concrete Column Designer to AS3600
EM Wave Propagation Calculator
section properties with units
Forward Kinematics of Robotic Arm with 6 Degrees of Freedom
İKSA YAPILARI PROJELENDİRME HİZMET BEDELİ (2024)
GEOTEKNİK RAPOR (EK-B) ASGARİ HİZMET BEDELİ (2024)
ZEMİN İYİLEŞTİRME/DERİN TEMEL PROJELENDİRME ASGARİ HİZMET BEDELİ (2024) (İMO)
🚀
Projectile motion
Loading
/custom-emojis/emojis/bending-moment.png
Dezi et. al (2010)
🤾
Projectile motion
API's banner
☁️

API

CalcTree's API allows you to get even more value out of your calculation pages by allowing you to integrate them into your external workflows.

Currently, CalcTree's API is read-only. Here's a quick summary what you can and can't do with the API in it's current state:


What can you do with the API ✅

What can’t you do with the API

API Key

Before you can use the CalcTree API, you need to generate an API key. To do so, follow these steps:
1. Clicking on "Settings & Members" in the top left corner of the CalcTree page


2. In the settings page, locate and click "API keys" in the top left corner

3. Click "Create API key" to create a new API key


4. A popup will appear, prompting you for the key name

  1. Once you've given a name, please save the generated key securely. You won't be able to view this token key again.


Turning on API integration

Before you can start using the CalcTree API, you need to enable API integration. To do so, go to the calculation page that you would like to use. On the right, you will see a sidebar.
  1. On the top right corner of the sidebar, click [+ Add]


  1. Next, click on the API integration button

  1. Now, your API has been added. Click on the arrow next to it and expand the details

From here, you can obtain the current page ID, which you will need to send a request


Using the API with Python without dependencies

First, you must define connection parameters:
  1. API endpoint URL, request headers with API key and content type

👉 Code Sample

2. Request payload depends on an API endpoint. See below for an example of the 'body' for calculation page endpoint

👉 Code Sample

body = { "pageId": "6fd16232-39e3-44a9-aee2-d6ad375698b0", "ctCells": [ {"name": "cylinder_radius", "formula": "100"}, ] } request_payload = json.dumps(body) . encode ("utf8")
Follow the body structure and fill it out using your pageID and the parameters as 'ctCells'

3. Send and parse a request:

👉 Code Sample

👉 Full Code Sample, also available here: link to the full code sample

API Endpoints

Calculation page

To calculate values for the provided page ID. You must specify at least one input parameter to initiate the calculation. Afterward, you'll get back all parameters from the page, with their values updated based on the provided input.
For any input parameters not explicitly provided, the calculation will use the default values set on the page.

Endpoint

https://api.calctree.com/api/calctree-cell/run-calculation

Request Syntax


Parameters:
- pageID - the identifier for the page on which you'd like to perform a calculation.
- ctCells - a list of input parameters you'd like to use for calculating outputs. Each parameter has a name identical to the one set on the page, including spaces, and a formula represented as a string type. To input the number 12.25, use the string '12.25'.

Response syntax



Example curl



CalcTree python client

To make it easier to work with the CalcTree API, we've released a CalcTree API Python Client. To use it:
Install CalcTree client using pip:
pip install calctree

Once you’ve installed the client you can used it like in the example below:

👉 sample

Client API

run_calculation
To calculate values for the provided page ID. You must specify at least one input parameter to initiate the calculation. Afterward, you'll get back all parameters from the page, with their values updated based on the provided input.
For any input parameters not explicitly provided, the calculation will use the default values set on the page.
Request syntax:

Parameters
- page_id - the identifier for the page on which you'd like to perform a calculation.
- ct_cells - a list of input parameters you'd like to use for calculating outputs. Each parameter has a name identical to the one set on the page, including spaces, and a formula represented as a string type. To input the number 12.25, use the string '12.25'.

Response
CalculationResult class:
  1. get_params(): Returns a list of all available parameters in the calculation result.
  1. get_values(): Retrieves a list of all parameter values in the calculation result.
  1. get_param_value(param_name): Get the value of a specific parameter by providing its name.
  1. to_dict(): Converts the calculation result into a list of dictionaries, each containing parameter names and values.
This class provides methods to easily access and manage the results of calculations from the CalcTree API. Use get_params() to see all available parameters, get_values() to get all values, get_param_value(param_name) for a specific parameter's value, and to_dict() to convert the result into a dictionary format for further processing.
For example: