Skip to end of metadata
Go to start of metadata

All functions of the Graphics Reactor can be accessed using REST API calls.


Get a list of files in a reactor folder

GET api/reactor/files?path="/foldername/"
Example
 curl -GET -L -H "Content-Type: application/json" http://sample.org/iteraplan/api/reactor/files?path=/ -u system:password
Result (success)
200
{"result":[
	{"name":"demoX4.xslt","size":"1189","date":1470921673068,"type":"file"},			
	{"name":"iteraplan.ecore","size":"204407","date":1470926259878,"type":"file"},
	{"name":"iteraplan.xmi","size":"239971","date":1470926260083,"type":"file"},
	{"name":"iteraplan.xml","size":"124","date":1470926274544,"type":"file"},
	{"name":"publicDemo_strategicBuildingBlock.html","size":"3107","date":1470926274533,"type":"file"},
	{"name":"README.txt","size":"87","date":1470840794944,"type":"file"}
]}
Result (folder not found)
404

Download a specific file in the reactor folder

GET api/reactor/files?path="/foldername/filename.xslt"
Example
curl -GET -L -H "Content-Type: application/xslt" --user "system:password" http://sample.org/iteraplan/api/reactor/files?path=/TestScript.xsl
Result (success)
200
File will be downloaded or directly displayed.
Result (file not found)
404

Create a subfolder in the reactor folder

POST api/reactor/files/create_folder?path="/foldername"
Body
empty
Example
curl -X POST http://localhost:8080/iteraplan/api/reactor/files/create_folder?path=/newFolder -u system:password
Result (success)
200
{"result": {"success":true}}
Folder created or folder already exists.

Delete a subfolder in the reactor folder

DELETE api/reactor/files?path="/foldername"
Example
curl -X DELETE http://sample.org/iteraplan/api/reactor/files?path=/Folder -u system:password
Result (success)
200
{"result": {"success":true}}

Upload a file to a reactor folder

POST api/reactor/files?path="/foldername/"
Body
File to upload
Example
curl -X POST -T demoX4.xslt http://sample.org/iteraplan/api/reactor/files?path="/" -u system:password
Result (success)
200
If path does not already exist it will be created.
The path has to end with a "/".

Delete a file in the reactor folder

DELETE api/reactor/files?path="/foldername/filename.xslt"
Example
 curl -X DELETE http://sample.org/iteraplan/api/reactor/files?path=/TestScript.xsl -u system:password
Result (success)
200
Result (folder not found)
404

Start a xsl-Script execution

POST api/reactor/scripts?path="/foldername/filename.xsl"
Example
 curl -X POST "http://sample.org/iteraplan/api/reactor/scripts?path=/TestScript.xsl" -u system:password 
Result: Script execution successfully started
200
{
	"success": true,
	"messages": [
    	"Script /TestScript.xsl execution started."
	]
}
Result: Script could not being started
200
{
	"success": false,
	"messages": [
		"Script cannot be executed, a different script is running:/TestScript.xsl. Started by system at Tue Oct 25 16:05:53 CEST 2016"
	]
}
Result (scipt not found)
404

Get Reactor Status (e.g. for polling requests)

GET api/reactor/scripts
Example
 curl -GET -L -H "Content-Type: application/json" http://sample.org/iteraplan/api/reactor/scripts -u system:password
Result: Reactor is ready
200
{
	"isRunning": false
}
Result: Reactor is ready (Calling user was executor of the last script)
200
{
	"isRunning": false,
	"success": true,
	"messages": [
		"Script \"/TestScript.xsl\" execution successfully completed."
	]
}
Result: Reactor busy (a script is currently being executed)
200
{
	"isRunning": true,
	"messages": [
		"The following script is running:/TestScript.xsl. Started by system at Tue Oct 25 16:04:18 CEST 2016"
	]
}
Result (script not found)
404

Configure script execution

Configure Published Output File

To change the properties for the published output file only, consider the following json object.

Body
{
        "scriptFileName":"/test.xslt",
        "publishedName":"test",
        "outputFileName":"output.txt",
        "roles": "admin, tom",
        "cacheTime":1
}

 

Note that it is important to send all properties at once. If one is missing, for instance "publishedName" the whole configuration of published output file will be reseted. Therefore, the given interface is extended which you see in the following.

PUT api/reactor/configs/publishing
Example
curl -X PUT "Content-Type: application/json" -d '{
        "scriptFileName":"/test.xslt",
        "publishedName":"test",
        "outputFileName":"output.txt",
        "roles": "admin, tom",
        "cacheTime":1
}' "http://sample.org/iteraplan/api/reactor/configs/publishing" -u system:password 
Result (success)
 200
{
  "publishedName": "test",
  "outputFileName": "output.txt",
  "roles": "admin, tom",
  "scriptFileName": "/test.xslt",
  "cacheTime": 1
}
Result (scipt not found)
 404


Read configuration

Read Published Configuration

GET api/reactor/configs/publishing?path=/path/to/test.xslt
Example
 curl -X GET -H "Content-Type: application/json" "https://sample.org/iteraplan/api/reactor/configs/publishing?path=/path/to/test.xslt"
Body
empty
Result (success)
200
{
  "publishedName": "test",
  "outputFileName": "output.txt",
  "roles": "admin, tom",
  "scriptFileName": "/path/to/test.xslt",
  "cacheTime": 1
}
Result (script not found)
404

Delete configuration

Analogously, the delete functionality is implemented. 

DELETE api/reactor/configs?path=/folderName/subFolder/script.xslt
Example
 curl -X DELETE -d '' "https://sample.org/iteraplan/api/reactor/configs?path=/demo2.xsl" -u system:password
Body
empty
Result (success)
200
{"scriptFileName":"publicDemo"}
Result (script not found)
404

Note that you can only apply a DELETE query on the whole configuration.

 

Execute Script with saved configuration

GET URL:published/publicDemo
Example
 curl -O -J -L https://sample.org/iteraplan/published/publicDemo -u system:password 
Result (success)
200
Result (script not found)
404
  • No labels