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.
The GroPy library provides an object orientated Python3 implementation. It can be installed using the pip installer using the package registered at the repository:
pip install GroPy --index-url https://gitlab.com/api/v4/projects/50527255/packages/pypi/simple
Additionally it is possible to only get the file GroPy.py from the repository and link it directly.
The library is based on three classes: Call, GroLink and WBRef.
A call object represents a possible request to the API
server and can be send with the run function and the
results can be interpreted with the read function. The run
function returns the object itself to enable a short
writing form: myCall.run().read()
. The
read function can return either a file, a json-String or a
WBRef object, depending on the command.
The GroLink class holds the connection to the API server and can create different calls for Project Management (e.g. create or open new workbenches), most of these commands return WBRef objects (List of Python commands). It is initialized with the address to the API server.
A WBRef object represents the connection to a workbench, it does not hold any information other than the id of the workbench and the link to the API server. This object provides function to create calls for the Project Interaction.(List of Python commands)
Due to the design of the API server it is possible to send
request regarding commands that where not originally part of
the GroLink project. To be able to address this command from
the python library the function
createAppCall(self, command, returnType=Call.JSON_RETURN, parameters=None, content=None)
or
createWBCall(self, command, returnType=Call.JSON_RETURN, parameters=None, content=None)
can be used.
link = GroPy.GroLink("http://localhost:58081/api/") link.createAppCall("/path/to/the/command") WBref1 = link.createWB().run().read() WBref1.createWBCall("/path/to/the/command")
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.
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”)
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”.
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 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. A list of all avialable commands can be found in the readme of the repository.