GenRocket Runtime API Overview
Important: This GenRocket feature requires users to have beginner-level programming skills. A user must understand REST, socket connections, and code-embedded jars.
What is the GenRocket API?
The GenRocket runtime application interface (API) allows programmers to access the GenRocket runtime to directly modify and create scenarios from their own programs. Programmers will have the following control over a Scenario:
- Modify Domains, Attributes, Generators, and Receivers
- Add Domains, Attributes, Generators, and Receivers to an existing Scenario
To use the GenRocket API, users need to have the GenRocket Runtime and the Scenarios they are modifying on their local machine.
GenRocket API Components
The diagram below shows the GenRocket components that allow an engineer to interface with the GenRocket API via their own application and an interface module.
API Concrete Interfaces
There are three concrete interfaces for accessing the GenRocket API:
- The GenRocket Binary Runtime
- The GenRocket Realtime Socket Engine
- The GenRocket Realtime REST Engine
The GenRocket Binary Runtime
Programmers developing applications with languages that compile down to a Java binary (e.g., Groovy, Scala, Python, Kotlin, Clojure, Ceylon, Quercus) can directly access the GenRocket binary runtime.
The GenRocket Realtime Socket Engine
Programmers developing applications that cannot directly access the GenRocket binary runtime may launch the GenRocket Socket Engine and make method calls via a socket. Each socket call requires sending a request payload and receiving a response payload. All payloads are in JSON.
The GenRocket Realtime REST Engine
Programmers developing applications that cannot directly access the GenRocket binary runtime may launch the GenRocket REST Engine and make method calls via Restful web services. Each socket call requires sending a request payload and receiving a response payload. All payloads are in JSON.
Attribute Naming Convention
An attributeName has the format of domainName.attributeName. If the domainName is not contained as the prefix of an attributeName, the domain will not be found.
Examples:
- User.lastName
- Organization.title
- Department.name
Generator Naming Convention
A generatorName must be the conical form of the Generator’s name.
Examples:
- com.genRocket.generator.RangeGen
- com.genRocket.generator.ListGen
- com.genRocket.generator.NameGen
API Example – Minimum Scenario
This Groovy example shows how to use the GenRocket API to build an absolute minimum Scenario from scratch and output one row to an XML file.
Activity Diagram
The activity diagram defines the steps and API calls necessary to load, modify and run the Scenario.
Example Using Native API
Note: To see the complete example, please refer to this article:
https://genrocket.freshdesk.com/a/solutions/articles/19000040228
List of API Methods
To view a list of available API methods, please refer to this knowledge base article:
https://genrocket.freshdesk.com/a/solutions/articles/19000076036
Search GenRocket Knowledge Base
Related Assets
API Examples and Methods Overview
The GenRocket runtime application interface (API) allows programmers to access the GenRocket runtime to directly modify and create scenarios from their own programs.
Read More