User Tools

Site Tools


user-guide:additional_interfaces:api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
user-guide:additional_interfaces:api [2025/01/22 12:33] – [GroPy] Timuser-guide:additional_interfaces:api [2025/10/27 17:30] (current) – [Client libraries] Tim
Line 1: Line 1:
-====== API GroIMP user guide ======+====== API ======
  
-With the use of the GroLink Project GroIMP can be started as an API server, that can handle Http-requests.+GroIMP can be started as an HTTP API that provides a generalized set of commands allowing interaction from other software. Currently a Python and a R library are provided but any software capable of HTTP requests could interact with GroIMP. This approach can be used to automatically start a simulation and interact with it during the execution.
  
 +
 +<uml>
 +@startuml
 +!pragma teoz true
 +hide footbox
 +title API
 +
 +participant User
 +participant ClientScript
 +participant API
 +participant GroIMP
 +
 +
 +User -> GroIMP: Start GroIMP
 +User -> ClientScript
 +ClientScript <->API
 +& API<-> GroIMP
 +User <- ClientScript
 +User -> GroIMP: Stop GroIMP
 +
 +
 +@enduml
 +</uml>
 ===== Installation and execution ===== ===== Installation and execution =====
  
Line 107: Line 130:
 Due to the generalized approach using registry paths, the HTTP commands are quite long and complex.  Due to the generalized approach using registry paths, the HTTP commands are quite long and complex. 
 To ease this and the management of the workbenches, client libraries are provided in R and Python. To ease this and the management of the workbenches, client libraries are provided in R and Python.
 +A mirror to the repositories can be found here: https://gitlab.gwdg.de/grolink-clients
 +
 ==== GroPy ==== ==== GroPy ====
  
Line 113: Line 138:
 pip install GroPy --index-url https://gitlab.com/api/v4/projects/50527255/packages/pypi/simple pip install GroPy --index-url https://gitlab.com/api/v4/projects/50527255/packages/pypi/simple
 </code> </code>
-Additionally it is possible to only get the file GroPy.py from the repository and link it directly. +Additionally it is possible to only get the file GroPy.py from the repository or {{ :user-guide:additional_interfaces:gropy.py |directly here}} and link it directly. 
  
 === Structure === === Structure ===
Line 145: Line 170:
 [[https://gitlab.com/grogra/groimp-utils/rapilibrary|R]] [[https://gitlab.com/grogra/groimp-utils/rapilibrary|R]]
  
-===== Tutorials and examples =====+{{ :user-guide:additional_interfaces:gror.r |GroR.r (direct download)}} 
 + 
 +=== Installation ==
 + 
 +The GroR package is not added to any public repository and must therefore be installed by hand. This can be done in different ways depending on your needs. 
 + 
 +== Adding the R file as a Source == 
 + 
 +It is possible to download the GroR.R file from this repository and link it to your R file with this code: 
 +''source("path/to/GroR.R")'' 
 + 
 +== Package == 
 + 
 +The releases contain packages that can be installed directly with either the R command: 
 + 
 +''install.packages("path/to/GroR_x.x.x.tar.gz", repos = NULL, type = "source")'' 
 + 
 +Alternatively, it is possible to install the package with the R Studio package manager by selecting “install from package archive file”. 
 + 
 +=== Structure === 
 + 
 +The library comes with two sets for functions, one set with the prefix "GroLink." and one with the prefix "WBRef.". The GroLink.* functions take the address of the API server as first input and provided a implementation for most [[#project_management | Project Management]] requests. Most of them return wb objects which are the first needed parameter for the WBRef.* functions. These functions implement the requests for [[#project_interaction | Project interaction]]. A list of all avialable commands can be found in the [[https://gitlab.com/grogra/groimp-utils/rapilibrary/-/blob/main/README.md|readme]] of the repository. 
 +  
 + 
 +===== More documentation ===== 
 + 
 +  * [[https://wkurth.grogra.de/oberlaender_msc.pdf| GroLink: implementing and testing a general application programming interface for the plant-modelling platform GroIMP (original Thesis)]] 
 +  * [[:groimp-platform:interfaces:api|API implementation]]
  
 ===== Tutorials ===== ===== Tutorials =====
  
 +
 +  * [[:Tutorials:Startup-API |Start the API]]
   * [[:Tutorials:Getting-started-with-GroLink-and-GroPy|getting started with GroLink and Python(GroPy)]]   * [[:Tutorials:Getting-started-with-GroLink-and-GroPy|getting started with GroLink and Python(GroPy)]]
   * [[:Tutorials:Getting-started-with-GroLink-and-GroR|getting started with GroLink and R(GroR)]]   * [[:Tutorials:Getting-started-with-GroLink-and-GroR|getting started with GroLink and R(GroR)]]
   * [[:Tutorials:Getting-started-with-GroLink-and-HTTP|getting started with GroLink and HTTP in your web browser]]   * [[:Tutorials:Getting-started-with-GroLink-and-HTTP|getting started with GroLink and HTTP in your web browser]]
   * [[:Tutorials:Handeling-data-in-GroLink-Projects|Handling data in GroLink projects]]   * [[:Tutorials:Handeling-data-in-GroLink-Projects|Handling data in GroLink projects]]
 +  * [[:Tutorials:grolink-on-kubernetes|Deploying GroIMP/GroLink on Kubernetes]] 
 +  * [[:dev-guide:create-new-api-function|How to create new API commands]]
  
 ===== Examples ===== ===== Examples =====
-  * [[https://gitlab.com/groimp-api-examples/pythonnotebook|Python Notebook]] + 
-  * [[https://gitlab.com/groimp-api-examples/forester-game|Godot Game]] +We provide examples in Python, R and Godot to get a first impression: https://gitlab.com/groimp-api-examples. (or here :https://gitlab.gwdg.de/grogra/groimp-api-examples) 
-  * [[https://gitlab.com/groimp-api-examples/apiplus|example Addition]]+Additionally you can find there a ready to use docker container to ease the first tests.
user-guide/additional_interfaces/api.1737545616.txt.gz · Last modified: 2025/01/22 12:33 by Tim