Integrating Web Sequence Diagrams with other services
Don Brown from Atlassian provided a
plugin for Confluence.
Carl Gould of Inductive Automation sent in a plugin for Trac. See the README file, and download here.
See below for command line interfaces in Python, Ruby, and Java.
Web pages
You can include diagrams in any web page, and they automatically update
when the page changes. Just copy these two lines, and put
your diagram source text between them.
Do not remove the <pre> tags. They are required to preserve
line-breaks on some browsers.
Example
<div class=wsd wsd_style="modern-blue" ><pre>
Alice->Bob: Authentication Request
Bob-->Alice: Authentication Response
</pre></div><script type="text/javascript" src="http://www.websequencediagrams.com/service.js"></script>
Alice->Bob: Authentication Request
Bob-->Alice: Authentication Response
You can set wsd_style to any of these styles:
- default
- earth
- modern-blue
- mscgen
- omegapple
- qsd
- rose
- roundgreen
- napkin
Limitations
Due to limitations in some browsers, the diagram description must be under 2 KB
after compression. If the diagram is too large, then no image will appear, but
the text will be displayed.
Integrating with other services
You can access the websequencediagrams server programmatically using a HTTP
POST request. Send the POST request to
http://www.websequencediagrams.com/index.php. The request must contain
"style" parameter, containing the name of the style to use. The "message"
parameter contains the text of the diagram. In response to the POST request,
websequencediagrams.com will return a string similar to the following:
{img: "?img=mscKTO107", page: 0, numPages: 1, errors: []}
The response is a JSON encoding of the
following fields:
- img: When appended to "http://www.websequencediagrams.com/", the result
is the URL of the image.
- page: always 0
- numPages: always 1
- errors: an array of errors in the source text, if there were any.
The image may be deleted from the server immediately after it is accessed. To
access the image again, you will have to regenerate it using a separate POST
request.
Python API
Here is an example implementation in python.
Java API
Here is an example implementation in Java.
Ruby API
Here is an example implementation in Ruby. Source:
http://github.com/EmmanuelOga/websequencediagrams/tree/master