Understanding the Geometry Backend API
In this series of articles (in progress), you will get an understanding of the core concepts of the Geometry Backend API. You will find answers to questions like:
How are my Grasshopper models represented on the Geometry Backend API?
How do I request computations or exports?
How are parameters defined on the Geometry Backend API, and how do they relate to Grasshopper?
What are outputs in terms of the Geometry Backend API?
What are exports in terms of the Geometry Backend API?
What are File parameters, and how do I take advantage of them?
How does the caching system work, and how do I take advantage of it? (coming soon)
Overview
Client applications communicate with the Geometry Backend via the Geometry Backend API. An example of this is the Viewer. The Geometry Backend fulfills the requests of the clients by looking up data from the cache and dispatching computation requests to the workers.
Core concepts, step by step
Example models
You can find the example models used in this section on the ShapeDiver Platform.
How to inspect the API
The best way to learn about the Geometry Backend API is to watch it work from a browser. How to start:
Open the gallery on the ShapeDiver Platform in your browser.
Open the developer tools of your browser (Note: examples shown here make use of Chrome developer tools).
Switch to the Network tab of the developer tools. This tab will show you the network requests sent by your browser.
Type “ticket” into the field for filtering network requests. This will allow you to easily identify the session init request to the Geometry Backend.
Note: You might need to reload the page before the developer tools show any network requests.Click on one of the models shown in the gallery. You should see something like this:
Select the request whose status shows “201” (shown in blue in the screenshot). This is the session init request.
Once you selected the request, switch to the tab called Preview. This will allow you to inspect the session init response from the Geometry Backend. If you look closely, you will see that there are properties called
parameters
,outputs
, andexports
.
You can undock the developer tools to a separate window, which provides you with a better overview.
If you want to see more, change the filter from “ticket” to “shapediver”. Be aware that this will also show you requests to the Platform Backend API. In case you want to filter Geometry Backend API traffic only, do this:
Make sure you have the session init request selected.
Switch to the tab called Headers and inspect the Request URL as shown in the following. Use the first component of the request URL as your filtering criterion (“sdr7euc1” in the following screenshot). This component corresponds to the alias of the specific Geometry Backend System on which the model you are inspecting is hosted.