If you wish to provide your own custom template service you can use the templateServiceUrl
startup parameter. This parameter defines a base url for a
REST service that
conforms to the specifications described below.
If you do not want to provide custom templates, omit the templateServiceUrl
parameter from
the startup method and the default templates will be provided by the
server.
editor = new ESDWeb(null, 'editorNode'); /* set other properties here */ editor.startup({ /* other parameters */, templateServiceUrl: "http://www.example.com/REST" });
There are three REST request you are must implement for a custom template service.
You may implement this REST service using the server-side technology of your choice. Please refer to the documentation for your server-side technology on how to accomplish this.
Note that the parameter <country code>
is included with each of these requests.
If your application supports multiple languages you can use this parameter to return localized results.
Request: <template service URL>/groups/<country code>
Returns a list of all template groups.
The result will be a JSON string in the following format:
[ "group name one", "group name two, ... ]
Request: <template service URL>/group/<country code>/<group
name>[?s=<search>]
Returns info on the templates in the group <group name>
where
<group name>
is a group name returned by Get Template Groups.
The template info may be limited to the template that match the search string <search>
.
The result will be a JSON string in the following format:
[ { "templateId": <template ID>, "name": "<template name>", "description": "<template description>", "keywords>": "<delimited text>" }, ... ]
The keywords
property can be multiple words delimited by a space, semicolon or comma.
Request: <template service URL>/template/<country code>/<template id>
Returns the template with ID <template id>
as an SVG string.