Chapter 9. Integration

Table of Contents

9.1. Integration by URL
9.2. Integration by API
9.2.1. Function setDocumentMenu
9.2.2. Function loadStringSVG
9.2.3. Function loadUrlSVG
9.2.4. Callback saveService
9.2.5. Function getSVG

DRAW-SVG can be used to edit svg documents within a web application.

There is two ways to integrate DRAW-SVG :

  1. By URL and REST services

  2. By API with jsChannel

DRAW-SVG website has several entry points to be called from another site.

Each entry point can have parameters. The general syntax of the URL for calling an entry point is :

http://www.draw-svg.appspot.com/drawsvg.html#entry:parameter1=value&parameter2=value

9.1. Integration by URL

This solution can only be used if your svg documents can be edited and updated by URL with a service (REST) to read (HTTP GET) documents and update them (HTTP PUT).

This use case is done with the 'svgrurl' entry with two parameters:

  1. the url parameter to specify the encoded url of the document to be edited.

  2. the save parameter with true or false value, If true, when saving the document, DRAWSVG will send a put request to the url with the document contents to save it (see save document ).

The general syntax is :

http://www.draw-svg.appspot.com/drawsvg.html#svgurl:url=encoded_url&save=true

To call DRAW-SVG with the svgurl entry, use an HTML 'a' element or an iframe element :

<a href='http://www.draw-svg.appspot.com/drawsvg.html#svgurl:url=encoded_url&save=true'>edit with drawsvg</a>