This repository has been archived by the owner. It is now read-only.

REST API

Tomotaka Sakuma edited this page Dec 17, 2013 · 8 revisions

** This API is in progress. Unstable **

Now http://jumly.tmtk.net/ provides these REST APIs.

/api/diagrams

GET

Responds a png images for a given jumly code.

query parameters

  • data
    urlencoded jumly code
    e.g. data=%40found+%22You%22

Example

A jumly code
@found "You", ->
  @message "Think", ->
    @message "Write your idea", "JUMLY", ->
      @create "Diagram"
jumly.css "background-color":"#8CC84B"
<img> tag
<img src='http://jumly.tmtk.net/api/diagrams?data=%40found+%22You%22%2C+-%3E%0A++%40message+%22Think%22%2C+-%3E%0A++++%40message+%22Write+your+idea%22%2C+%22JUMLY%22%2C+-%3E%0A++++++%40create+%22Diagram%22%0Ajumly.css+%22background-color%22%3A%22%238CC84B%22'/>
Image you get

http://jumly.tmtk.net/api/diagrams?data=%40found+%22You%22%2C+-%3E%0A++%40message+%22Think%22%2C+-%3E%0A++++%40message+%22Write+your+idea%22%2C+%22JUMLY%22%2C+-%3E%0A++++++%40create+%22Diagram%22%0Ajumly.css+%22background-color%22%3A%22%238CC84B%22


POST

Responds body in some formats for a given jumly code.

It supports next.

  • image
    • PNG, GIF, JPEG
    • base64 encoded
  • text/html

Actually JPEG is NOT recommended because of no transparent background.

And also you can get response body in base64 if you want.

In addition, HTML is available.

Headers

  • Content-Type
    text/jumly+sequence

  • Accept
    image/png, image/png;base64,
    image/gif, image/gif;base64,
    image/jpeg, image/jpeg;base64,
    text/html

Examples

PNG format

Default format is PNG if accept header is missing.
Binary data is responded.

curl -XPOST \
     -H"content-type:text/jumly+sequence" \
     jumly.tmtk.net/api/diagrams \
     -d "\@found 'You'" 
Base64-encoded

Base64-encoded body is responded.

curl -XPOST \
     -H"content-type:text/jumly+sequence" \
     -H"accept:image/png;base64" \
     jumly.tmtk.net/api/diagrams \
     -d "\@found 'You'" 
iVBORw0KGgoAAAANSUhEUgAAAHEAAABW...
HTML format
curl -XPOST \
     -H"content-type:text/jumly+sequence" \
     -H"accept:text/html" \
     jumly.tmtk.net/api/diagrams \
     -d "\@found 'You'" 
<link rel="stylesheet" href="http://jumly.tmtk.net/release/jumly.min.css"/>
<div class="sequence-diagram diagram" style="width: 100px; "><div class="participant found" style="left: 0px; "><div class="name">You</div></div><div class="interaction activated"><div class="occurrence leftmos
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.