[deepamehta-devel] Creating and filling a Topic-Map via API

Jörg Richter jri at deepamehta.de
Thu Jan 26 13:29:43 CET 2017


Hi Juergen,

yes, you can do this.

To create a standard (not geomap) Topicmap:

	curl -H "Authorization: Basic YWRtaW46" -H "Cookie: dm4_workspace_id=2610" -X POST localhost:8080/topicmap?name=My+ToDo+Map\&renderer_uri=dm4.webclient.default_topicmap_renderer\&private=false

In this example "My+ToDo+Map" is the (URL encoded) name of the topicmap (mandatory).

2610 is the ID of the workspace the map will be assigned to.

A workspace assignment is recommended. Otherwise the Topicmap would not appear in the Webclient menus, nor would be deletable.

You can also set the topicmap's Private flag (optional). Default is false.

The renderer_uri is mandatory.

The response is the created Topicmap topic.
This gives you the topicmap ID:

        {
          "id": 4250,
          "uri": "",
          "type_uri": "dm4.topicmaps.topicmap",
          "value": "My ToDo Map",
          "childs": {
            ...
          }
        }

To add a topic to a topicmap:

        curl -H "Authorization: Basic YWRtaW46" -H "Content-Type: application/json" -X POST localhost:8080/topicmap/4250/topic/8092 -d '{
            "dm4.topicmaps.x": 200,
            "dm4.topicmaps.y": 150,
            "dm4.topicmaps.visibility": true
        }'

Here 4250 is the topicmap, 8092 is the topic to add. The topic must exist already.
If the topicmap or the topic do not exist, you'll get an error response.

You can't add the same topic twice to a topicmap. If you do so you'll get an error response.

The message body is a JSON object with the view properties (mandatory).
IMPORTANT: the view properties (x, y, visibility) MUST be supplied, otherwise the topicmap will become corrupt.

The response is 204 No Content.

You can do many more things, like add associations to a topicmap, move things, hide things, set topic background color, or set a topicmap background image. Tell me if you need more information.

Please excuse the late reply.

Cheers,
Jörg


> On 19 Jan 2017, at 15:18, Juergen Neumann <j.neumann at junes.eu> wrote:
> 
> Dear Jörg,
> 
> is there a way to create an new topic map via the REST API and also
> "fill" it with existing content. My goal is to create a Todo-List-
> Topicmap for topics that need reviewing showing the revealed todo-
> topics.
> 
> If possible, could you provide a curl script example for it, please.
> 
> Thank you very much in advance!
> 
> Juergen

-------------- n�chster Teil --------------
Ein Dateianhang mit Bin�rdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigr��e  : 496 bytes
Beschreibung: Message signed with OpenPGP using GPGMail
URL         : <http://lists.deepamehta.de/pipermail/devel-lists.deepamehta.de/attachments/20170126/f7578371/attachment.sig>


More information about the devel mailing list