Using the RESTful API we’ll implement all elements of the RESTful API supporting collections of Process Models, Process Model instances and events. Using the RESTful API Process Models can be modified, instantiated, executed etc.
An example of how to use DCR Active Repository using the Postman tool can be found here.
Access to DCR Active Repository requires your DCR username and password and use http basic authentication. Access to the repository requires a commercial license.
The engine API interface outlines the programmatic interface.
URL | GET | PUT | POST | DELETE |
DCR Process Models https://repository.dcrgraphs.net/api/graphs | *List URIs of process models, id and titles in collection. Filter options exists to search/filter specific proess models. Optional parameters are: title=title – will search for procss models containing “title” in title sort=title (default) – sort proess models by title or other fields orderby=asc(default) sort: can be title, id, created, modified orderby: asc or desc | NA | *Create a new DCR Process Model, returning the id. A DCR Process Model is described using DCR XML | NA |
DCR Process Model https://repository.dcrgraphs.net/api/graphs/id | *Retrieve the DCR Process Model represented as DCR XML If sending the parameter “?LatestMajor=true” the repository will return the latest major version of the Process Model.”filter=splice” will splice any fragment into the main model.”filter=localecsv” will return a CSV file for DCR Forms for localization. | *Update the DCR Process Model using DCR XML | NA | Remove the process model |
DCR Process Model Wiki https://repository.dcrgraphs.net/api/graphs/id/wiki | Retrieve the DCR Process Model in wiki format | NA | NA | NA |
DCR Process Model versions https://repository.dcrgraphs.net/api/graphs/id/versions | *Retrieve the versions of the DCR process model as outlined below. Using the parameter “?Versions=major or All” a list of versions will be returned as outlined in below.THe parameter “Versions=major&tags=<tag1,…,tagn>” will return all major revisions with the provided tags. | NA | * Compare two DCR Process Models. Either by sending the full xml or by sending the ids of the versions. | NA |
DCR Process Model version https://repository.dcrgraphs.net/api/graphs/id/versions/id | *Retrieve the version XML of the specific DCR Process Model. If “?RevisionXml=true” it does not return the Process Model xml but the comparison of the latest major revision. | NA | NA | NA |
DCR Process Model version wiki https://repository.dcrgraphs.net/api/graphs/id/versions/id/wiki | Retrieve the process model in DCR wiki format | NA | NA | NA |
DCR Process Model meta data https://repository.dcrgraphs.net/api/graphs/id/meta | *Retrieve meta data about the specific DCR Process Model. XML example below. | NA | NA | NA |
DCR Process Model instances https://repository.dcrgraphs.net/api/graphs/id/sims | *Retrieve the DCR Process Model instances, i.e. instance id (simid) and title. Various filters exists to retrieve representative and swimlane process models: isScenario=true or false – if true returns only scenarios (representative Process Models) Format=DCRXMLLog – optional, only used if DCR XML Log format is needed. Format=XES – optional, only used if XES format is needed.Filename=log.xml – optional filename | NA | *Instantiate a DCR Process Model returning a new instance ID (simid). An optional Title of the simulation can be provided. API enhanced and now support creating multiple instances by important DCR XML Log which creates multiple instances at the same time. Use parameter Log to enable import. LatestMajor=true” is defined the instance will be based on the latest major version of the Process Model. Initialization time can be given in JSON body as outlined below. | NA |
DCR Process Model instance https://repository.dcrgraphs.net/api/graphs/id/sims/simid | *Retrieve the DCR Process Model instance A filter exists, ?filter=isAccepting, which will return true or false depending on whether the DCR Process Model instance is accepting or not | *Parameter ?complete=true will mark the simulation as completed, complete=false will un-complete the simulation Parameter ?Title=… will update the title of the simulation | *Parameter ?Log=… – will update the simulation | *Delete the instance |
DCR Process Model instance events https://repository.dcrgraphs.net/api/graphs/id/sims/simid/events | *Retrieve the events of the DCR Process Model instance Filter must be provided to search/filter specific instances filter=all filter=enabled-or-pending filter=only-enabled filter=only-pending | NA | *Create a new event in the Process Model using the XML in the body illustrated below under events | NA |
DCR Process Model instance event https://repository.dcrgraphs.net/api/graphs/id/sims/simid/events/eventid | **Retrieve the DCR Process Model instance event | *Mark the event as excluded Use “?filter=exclude” | *Execute the event If you add “?filter=note” to the URL you can post a note with the event. This note will be saved as a comment in the DCR XML Log. The role of the event can be passed in the body of the call as a JSON parameter: { Role:’admin’ } | *Delete the event |
DCR Process Model instance relations https://repository.dcrgraphs.net/api/graphs/id/sims/simid/relations | *Retrieve the DCR Process Model instance relations | NA | *Create a new relation | *Delete a relation given sourceId, targetId and relation type |
DCR Process Model time https://repository.dcrgraphs.net/api/graphs/id/sims/simid/time | NA | NA | *Set absolute time in Process Model as outlined in body (see details below). | NA |
DCR Process Model categories https://repository.dcrgraphs.net/api/categories | Get list of categories | NA | Create a new category | |
DCR Process Model categories https://repository.dcrgraphs.net/api/categories/id | Retrieve specific category | NA | Update category | Delete category |
DCR Process Model categories https://repository.dcrgraphs.net/api/categories/id/graphs | Retrieve Process Models for specific category | NA | NA | NA |
Notice: The list of URLs is not complete and not everything is implemented at the moment. We’ve marked working areas with an asterisk (*).
DCR Process Model are represented using DCR XML which is the output of the DCR designer tool. DCR XML is used both for classes and instances of processes.
The list of Process Model returned contain the following data:
<graphs>
<graph id=”1234″ title=”My first graph” />
</graphs>
When you initialize a Process Model you can provide the initialization time in the JSON body together with the title of the new instance:
{Title: “PostMan Simulation”,
init:”2020-03-29T11:43:47.1280000Z”
}
The list of roles returned contain the following data:
<roles>
<role title=”user” description=”This is the user” />
<role title=”responsible” description=”The responsible person” />
</roles>
The list of events returned contain the following data:
<events isAccepting=”true|false” nextDeadline=”…” nextDelay=”…” phase=”…”>
<event id=”Activity 3″ included=”true” enabled=”true” pending=”false” executed=”false” fullPath=”Activity 3″ roles=”” groups=”” description=”” label=”Activity 3″ eventType=”” />
<event id=”Activity 5″ included=”true” enabled=”true” pending=”false” executed=”true” fullPath=”Activity 5″ roles=”” groups=”” description=”” label=”Activity 5″ eventType=”” />
<event id=”Activity 6″ included=”true” enabled=”false” pending=”true” executed=”false” fullPath=”Activity 6″ roles=”” type=”…” referId=”…” groups=”” description=”” label=”Activity 6″ eventType=”” />
</events>
The “type” attribute can be “subprocess”, “form”, “nesting”, “instance” or just empty.
The referId attribute points to a graphId – only supported for DCR Forms.
The Execute event takes optional data parameters in the form:
{DataXML: ‘<globalStore><variable id=”‘eventid'” type=”…” value=”…” isNull=”true|false”/> </globalStore>’,
Role: ‘role }
The set absolute time of a Process Model post the following data in the body: <absoluteTime>ISO 8601 time here</absoluteTime>.
Notice – time must be GMT+0, i.e. not local time zone. Format is ISO 8601, i.e. yyyy-mm-ddTHH:MM:ssZ etc.
The data should be in JSON format so in fact we send e.g.
{
time: ‘<absoluteTime>2018-09-05T10:40:27.9197330Z</absoluteTime>.‘ }
Deleting relations take the following JSON structure as a body:
{ sourceId:”Activity1″, targetId:”Activity0″, type: “condition” , }
type is the relationType which can be one of the following values “condition”, “response”, “include”, “exclude”, “milestone” or “spawn”.
The RESTful API will be expanded to include all events and relations of Process Models as well as simulations/instances, thereby enabling adding, updating and removing events and relations directly.
Versions are returned in the following XML:
<versions >
<version id=”64774″ type=”major” title=”First major version” date=”2018-10-01 12.45.22.111z” user=”6″ />
<version id=”64772″ type=”minor” date=”2018-10-01 12.42.22.111z” user=”4″ />
<version id=”64770″ type=”minor” date=”2018-10-01 12.40.22.111z” user=”4″ />
</versions>
We’ve created a Windows application for DCR Active Repository that you can use to experiment with the DCR Active Repository. The source code in C# is available for download.
Meta data about a Process Model returns the following XML:
<graph id=”4013″ title=”Expense – milestone – good coding practice”>
<Collections>
<Collection id=”1952″ title=”DCR Academy” ></Collection>
</Collections>
<Categories>
<Category id=”2252″ title=”DCR Academy – Public Repository” >
<SharedWith>
<user id =”107″ UserName=”hnor” ModeOfSharing=”CanEdit”></user>
<user id =”1526″ UserName=”lopez@itu.dk” ModeOfSharing=”CanEdit”></user>
<user id =”4″ UserName=”marquard” ModeOfSharing=”CanEdit”></user>
</SharedWith>
</Category>
</Categories>
<Owner id=”4″ UserName=”marquard” OrganizationId=”1″ Organizationtitle=”Community” ></Owner>
<SharedWith>
<user id=”42″ UserName=”Hamza.Ahmad” ModeOfSharing=”CanEdit” ></user>
</SharedWith>
</graph>
Accessing this API requires a commercial license.