Table of Contents
Getting started with GroLink and HTTP
To show the usage of the API without a client library this tutorial uses HTTP calls by just opening them in the webbrowser. This Tutorial shows only a limited functionality because HTML hyperlinks can not send a request body.
Requirements
- A GroIMP version including the API plugin is needed, the first version including the API is 2.1.
It is at any point necessary that GroIMP is running as the API server. How to start it is explained here.
This Tutorial only works if the API server runs on the same machine on port 58081.
Starting API and creating the workbench
To create a workbench in GroIMP and receive the workbench id the create command is used. All commands can be found here
This should return the ID in a JSON format. For this tutorial, it is assumed that the ID is 1
Find the first information
The first command requests the project graph of the new created project
This returns a JSON structure that includes a list of the nodes, and a list of the edges as a vector in the style: (patent, child, edge byte) and the id of the root.
The next command returns a list of the existing rgg functions.
Or the list of the source files:
Or the content of a source file:
Execute functions and queries
To get a better understanding of the models, it is possible to run XL queries:
It's important to mention that more complex queries must be committed within the body of a request because the syntax conflicts with the standards of HTTP.
To run one of the above-listed RGG functions the following command can be used:
If a function is executed that does print something it would be shown in the returned json.
After the second command was executed the first would return a different result.
It is also possible to send XL rewriting rules like the following, that turns all A nodes into F nodes:
Save and close
For saving the changes the following link just returns the model for downloading:
It must be renamed to .gsz but then it can be opened in GroIMP as usual.
Finally, the workbench can be closed.