Not logged in - Login
View History

Using Postman to access DCR Active Repository

DCR Active Repository provides a RESTful API to manipulate graphs and simulations. This section will give an example of how to use the Postman tool to manipulate graphs and simulations.

We'll provide four examples

  1. Get a list of your graphs in DCRGraphs.net
  2. Start simulation of a specific graph
  3. Get a list of enabled or pending events in the simulation
  4. Execute an event in a simulation

Download and install Postman and start the application.

Postman tool started

Get a list of your graphs in DCRGraphs.net

Enter the URL http://www.dcrgraphs.net/api/graphs in the URL line and set the action to GET. Then click Send.

You'll then get a 403, access denied, back.

Click on "No Auth" and select "Basic Auth", enter username and password and click Update Request:

Postman Update Request
Then click on Send again

Postman list of DCR graphs
The list looks like this:
<graphs>
<graph id="1234" title="My first graph" />
...
</graphs>

Start simulation of a specific graph

Start a simulation by a POST to the following URL: http://www.dcrgraphs.net/api/graphs/<graphid>/sims

As above, ensure username and password are provided.

Clicking SEND will give returncode 201 and the simulation id

Postman Instantiate Graph
x-dcr-simulation-id -> 29535

The returncode is 201 on success.

Get a list of enabled or pending events in the simulation

To get a list of enabled or pending events for a simulation you must do a GET to the following URL: http://www.dcrgraphs.net/api/graphs/<graphid>/sims/<simid>//events?filter=enabled-or-pending

Postman Get Enabled or Pending events
The events is returned in a format as outlined below:

<events isAccepting="true|false" nextDeadline="..." nextDelay="...">
<event id="Activity0" included="true" enabled="true" pending="false" executed="false" fullPath="Activity0" roles="" groups="" description="" label="Do some work" eventType="" /> </events>

The returncode is 200 on success.

Execute an event in a simulation

Executing an event is done by making at POST to the following URL: http://www.dcrgraphs.net/api/graphs/<graphid>/sims/<simid>/events/<eventid>

Postman Execute Event

Execute an event in a simulation with data

Executing an event is done by making at POST to the following URL: http://www.dcrgraphs.net/api/graphs/<graphid>/sims/<simid>/events/<eventid>

When posting you need to pass the data value:

{DataXML:'<globalStore><variable id="Data" value="1" isNull="false" type="int" /></globalStore>'}

Postman Execute Event with data
Notice: The value is XML send as a JSON object.

The returncode is 204 on success.