yFiles AJAX Web Application Interface

This document describes the resources available from the yFiles AJAX web application. In other words it documents the web application interface of the server side of yFiles AJAX.

This document was created from a WADL description using the wadl_documentation.xsl XSL stylesheet by Mark Nottingham ( http://www.mnot.net/ ) used under the terms of the Creative Commons Attribution-ShareAlike 2.5 License.

Requests

/ getImage?zoom&col&row&size&path

The resource returned for this request is a graph tile. A graph tile is an image of a part of the graph. The image of a tile is a quadratic PNG. Its magnification with respect to the world coordinates of the graph is controlled by the zoom factor. For a fixed graph and a fixed zoom factor, all tiles form a grid covering the plane containing the graph. One of those tiles is specified by its column and row.

GET

parameter value description

zoom

double(required)

the zoom factor, strictly greater than 0, 1.0 is the "original" size of the graph

col

integer(required)

the colum of the image, the left edge of the image corresponds to col*size/zoom in world coordinates

row

integer(required)

the row of the image, the upper edge of the image corresponds to row*size/zoom in world coordinates

size

integer(required)

the size of the image (width and height) in pixels

path

string(required)

the name of the graph, which is shown on the image

/ getWorldBounds?path

the world bounds as an enclosing rectangle for a given graph in comment filtered JSON format

GET

parameter value description

path

string(required)

the name of the graph

/ getElementBounds?path&x&y&width&height&types

hit test information for a given graph and a given axis-parallel query rectangle in comment filtered JSON format

GET

parameter value description

path

string(required)

the name of the graph

x

double(required)

left edge of the query rectangle in world coordinates

y

double(required)

upper edge of the query rectangle in world coordinates

width

double(required)

width of the query rectangle in world coordinates

height

double(required)

height of the query rectangle in world coordinates

types

integer(required)

types of elements to be included into the response as a bitmask (e.g. 3 means nodes and edges)

  • 1: include nodes
  • 2: include edges
  • 4: include node labels
  • 8: include edge labels

/ getViewInfo?path&x&y&width&height&types

hit test information for a given graph and a given axis-parallel query rectangle in comment filtered JSON format

GET

parameter value description

path

string(required)

the name of the graph

x

double(required)

left edge of the query rectangle in world coordinates

y

double(required)

upper edge of the query rectangle in world coordinates

width

double(required)

width of the query rectangle in world coordinates

height

double(required)

height of the query rectangle in world coordinates

types

integer(required)

types of elements to be included into the response as a bitmask (e.g. 3 means nodes and edges)

  • 1: include nodes
  • 2: include edges
  • 4: include node labels
  • 8: include edge labels

/ getHierarchyInfo?path

hierarchy information for a given graph in comment filtered JSON format

GET

parameter value description

path

string(required)

the name of the graph

/ loadableGraphs

a list of names of graphs in comment filtered JSON format, which are suitable for loadGraph

GET

/ loadGraph?path&reload

If the value of the parameter "path" is "foo.ygf", and there is not yet a graph cached for the name "foo.ygf" in the session of the request, then the graph is loaded from the file "foo.ygf" from the directory "resources/graphs" in the web application, to which this servlet belongs, and cached using the name "foo.ygf". Reloading a graph which is already cached can be forced by setting the optional parameter "reload" to "true".

POST

parameter value description

path

string(required)

the name of the graph

reload

string

One of:

  • true
  • false

forces reloading, if the graph was loaded before

/ downloadableFormats

a array of file format descriptions available for downloadGraph in comment filtered JSON format, each entry is an array containing a description and a file name extension, e.g., ["GraphML Format","graphml"]

POST

/ downloadGraph?path&format&x&y&zoom&width&height

The "downloadGraph" request has a mandatory parameter "path" and an optional parameter "format". The parameter "path" contains the name of the graph to be downloaded.

The parameter "format" specifies the format for the download. It defaults to "ygf". Possible values can be queried with a "downloadableFormats" request. The values are filename extensions of yFiles graph formats; "ygf", "gml", "graphml", "graphmlz" and "tgf". Moreover some image formats are supported: "gif", "jpg", "png" and "bmp" Depending on the server configuration "png" and "bmp" may not be available and "pdf" and "swf" may additionally be available, if the server can access yExport. The response for this request is a binary stream containing the graph in the requested format. For the graph formats "ygf", "gml", "graphml", "graphmlz" and "tgf" the whole graph is exported. For the image formats "gif", "jpg", "png" and "bmp" there are additional parameters for specifying the size and contents of the target image.

The parameters x, y, zoom, width and height are required for image formats. They specify the part of the graph to be exported and the magnification of the target image. Note that there is a limit of 2000 on the target width and height in order to protect the server from allocating too much memory for a single request. If a width or height greater than this limit is requested, then width, height and zoom are scaled down to meet the limits before the request is processed.

POST

parameter value description

path

string(required)

the name of the graph

format

string

One of:

  • ygf
  • gml
  • graphml
  • graphmlz
  • tgf
  • gif
  • jpg
  • png

the format for the response (default: ygf), depending on the server additional formats are possible (see "downloadableFormats")

x

double

left edge of the exported image in world coordinates for image formats, this parameter is required for image formats

y

double

upper edge of the exported image in world coordinates for image formats, this parameter is required for image formats

zoom

double

zoom of the exported image for image formats, this parameter is required for image formats

width

integer

width of the exported image in pixels for image formats, this parameter is required for image formats

height

integer

height of the exported image in pixels for image formats, this parameter is required for image formats

/ newGraph?name

caches a new empty graph for the given name

POST

parameter value description

name

string(required)

the name of the graph

/ getRealizers

returns a comment filtered JSON object containing the names of the available node types (node realizers)

GET

/ getRealizerImage?type

returns a PNG image showing a sample node realized with the given node realizer

GET

parameter value description

type

string(required)

the name of the node realizer (node type), suitable values are returned by getRealizers

/ createNode?name&x&y&type

creates a new node in a cached graph and returns a comment filtered JSON object containing the id of the new node and the new world bounds

POST

parameter value description

name

string(required)

the name of the graph

x

double(required)

x coordinate of the new node in world coordinates

y

double(required)

y coordinate of the new node in world coordinates

type

string

the type of node, suitable values are returned by getRealizers

/ createGroup?name&x&y&closed&type&subNodeIds&parentNodeId

creates a new group or folder node in a cached graph and returns a comment filtered JSON object containing the id of the new node and the new world bounds

POST

parameter value description

name

string(required)

the name of the graph

x

double

x coordinate of the new node in world coordinates (default 0)

y

double

y coordinate of the new node in world coordinates (default 0)

closed

string

One of:

  • true
  • false

a folder node is created, if this parameter is true, a group node otherwise (default)

type

string

the type of node, suitable values are returned by getRealizers

subNodeIds

string

comma separated ids of the nodes to become members of the inner graph of the newly created node

parentNodeId

string

id of the parent group or folder node for the new group node, if not specified and no subnode ids are given use the currently visible subgraph, if not specified and subnode ids are given, their nearest common ancestor becomes the parent of the new group

/ closeGroup?name&id

converts the group node with the given id into a folder node.

POST

parameter value description

name

string(required)

the name of the graph

id

string(required)

the id of a group node

/ openGroup?name&id

converts the folder node with the given id into a group node.

POST

parameter value description

name

string(required)

the name of the graph

id

string(required)

the id of a folder node

/ createEdge?name&source&target&route

creates a new edge in a cached graph and returns a comment filtered JSON object containing the id of the new edge and the new world bounds

POST

parameter value description

name

string(required)

the name of the graph

source

string(required)

the id of the source node

target

string(required)

the id of the target node

route

integer

route the created edge, if this parameter exists and is not equal to 0

/ moveNodes?name&ids&x&y

moves the positions of a set of nodes according to a shift vector

POST

parameter value description

name

string(required)

the name of the graph

ids

string(required)

comma-separated ids of nodes to be moved

x

double(required)

x coordinate of the shift vector in world coordinates

y

double(required)

y coordinate of the shift vector in world coordinates

/ removeAt?name&x&y

removes the first node or edge at the given coordinates and returns a comment filtered JSON object containing the id of the removed node or edge if any and the new world bounds

POST

parameter value description

name

string(required)

the name of the graph

x

double(required)

x coordinate in world coordinates

y

double(required)

y coordinate in world coordinates

/ remove?name&ids

removes the graph elements with the given ids and returns a comment filtered JSON object containing the id of the removed node or edge if any and the new world bounds. Note that dependent objects are also removed. For example removing a node leads to removing all its adjacent edges and all labels of the removed node and the adjacent edges.

POST

parameter value description

name

string(required)

the name of the graph

ids

string(required)

comma-separated ids of graph elements to be removed

/ getLabel?name&id

returns the text of the given node label or the text of the first label of the given node as a plain text in UTF-8 encoding.

POST

parameter value description

name

string(required)

the name of the graph

id

string(required)

the id of a node or node label

/ setLabel?name&id&label

sets the text of the given node label or the text of the first label of the given node and returns a comment filtered JSON object containing the id of the label and the new world bounds.

POST

parameter value description

name

string(required)

the name of the graph

id

string(required)

the id of a node or node label

label

string(required)

the label text

/ layout?name&type

performs a layout algorithm on the given graph and returns a comment filtered JSON object containing the new world bounds.

POST

parameter value description

name

string(required)

the name of the graph

type

string(required)

One of:

  • hierarchic
  • organic
  • orthogonal

the type of layout to be performed

/ switchToSubgraph?name&id

switches the currently displayed graph to the inner graph of a group or folder node.

POST

parameter value description

name

string(required)

the name of the graph

id

string(required)

the id of a group or folder node

/ switchToParent?name

switches the currently displayed graph to its parent graph.

POST

parameter value description

name

string(required)

the name of the graph

/ moveToSubgraph?name&subNodeIds&parentNodeId

moves a set of nodes to another nested graph.

POST

parameter value description

name

string(required)

the name of the graph

subNodeIds

string(required)

comma separated ids of the nodes to be moved

parentNodeId

string

the id of a group or folder node, which is the parent of the target graph (default root graph)

/ moveToParent?name&subNodeIds

moves each node in a set of nodes one level up.

POST

parameter value description

name

string(required)

the name of the graph

subNodeIds

string(required)

comma separated ids of the nodes to be moved


Copyright (c) 2006-2008 yWorks. All Rights Reserved.