wiki:RestApi

Version 5 (modified by jri, 13 years ago) (diff)

Getting all topic type URIs

DeepaMehta REST API

The DeepaMehta application service is accessible via a REST API.

About the REST API:

All requests return application/json data.

For requests that take data in the request body: The data is expected to be of type application/json as well. So, don’t forget to set the request’s Content-Type header accordingly. Otherwise an error is returned (as application/x-www-form-urlencoded is used as the default).

About the curl examples:

The curl examples are ready for being pasted into a terminal. However, the IDs must be adjusted to your actual DB content. Hint: to determine a topic's or association's ID click it in the webclient and read the console log.

In order to make the responses more readable the curl examples make use of the jsonpretty tool. Jsonpretty is installable as a Ruby gem. See http://github.com/nicksieger/jsonpretty.

Topics

Get topic by ID

GET /core/topic/<topic ID>[?fetch_composite=true/false]

The default for fetch_composite is true.

Example 1: Getting a topic with its composite value

curl localhost:8080/core/topic/2676 | jsonpretty

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 2676,
  "uri": "",
  "type_uri": "dm4.notes.note",
  "value": "What is DeepaMehta?",
  "composite": {
    "dm4.notes.title": "What is DeepaMehta?",
    "dm4.notes.text": "<p>DeepaMehta is a think tool.</p>"
  }
}

For details about the topic data format see DataFormat#topic.

Example 2: Getting a topic without its composite value

curl localhost:8080/core/topic/55?fetch_composite=false | jsonpretty

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 2676,
  "uri": "",
  "type_uri": "dm4.notes.note",
  "value": "What is DeepaMehta?",
  "composite": {
  }
}

If the topic doesn’t exist an error 500 Retrieving topic xy failed is returned. (The error response might become more HTTP/REST conform in the furure.)

Create topic

POST /core/topic

<the topic>

Example 1: Creating a simple topic

curl localhost:8080/core/topic -i \
-X POST \
-H Content-Type:application/json \
-d '{type_uri: "dm4.contacts.city", value: "Port-au-Prince"}' \
| jsonpretty

For details about the topic data format see DataFormat#topic.

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 3448,
  "uri": "",
  "type_uri": "dm4.contacts.city",
  "value": "Port-au-Prince",
  "composite": {
  }
}

Example 2: Creating a complex topic

curl localhost:8080/core/topic -i \
-X POST \
-H Content-Type:application/json \
-d '{type_uri: "dm4.notes.note",
     composite: {
       dm4.notes.title: "My title",
       dm4.notes.text: "<p>My test text here<p>"}}' \
| jsonpretty

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 3298,
  "uri": "",
  "type_uri": "dm4.notes.note",
  "value": "My title",
  "composite": {
    "dm4.notes.title": "My title",
    "dm4.notes.text":"<p>My test text here<p>"
  }
}

Associations

Topic Types

Getting all topic type URIs

curl localhost:8080/core/topictype -i

Response:

HTTP/1.1 200 OK
Content-Type: application/json

[
  "dm4.contacts.address",
  "dm4.contacts.address_entry",
  "dm4.contacts.address_label",
  "dm4.contacts.city",
  "dm4.contacts.country",
  "dm4.contacts.email_address",
  "dm4.contacts.first_name",
  "dm4.contacts.institution",
  "dm4.contacts.institution_name",
  "dm4.contacts.last_name",
  "dm4.contacts.person",
  "dm4.contacts.person_name",
  "dm4.contacts.phone_entry",
  "dm4.contacts.phone_label",
  "dm4.contacts.phone_number",
  "dm4.contacts.postal_code",
  "dm4.contacts.street",
  "dm4.core.assoc_type",
  "dm4.core.cardinality",
  "dm4.core.data_type",
  "dm4.core.index_mode",
  "dm4.core.meta_meta_type",
  "dm4.core.meta_type",
  "dm4.core.plugin",
  "dm4.core.plugin_migration_nr",
  "dm4.core.plugin_name",
  "dm4.core.plugin_symbolic_name",
  "dm4.core.role_type",
  "dm4.core.topic_type",
  "dm4.files.content",
  "dm4.files.file",
  "dm4.files.file_name",
  "dm4.files.folder",
  "dm4.files.folder_name",
  "dm4.files.media_type",
  "dm4.files.path",
  "dm4.files.size",
  "dm4.notes.note",
  "dm4.notes.text",
  "dm4.notes.title",
  "dm4.topicmaps.description",
  "dm4.topicmaps.name",
  "dm4.topicmaps.topicmap",
  "dm4.topicmaps.visibility",
  "dm4.topicmaps.x",
  "dm4.topicmaps.y",
  "dm4.webbrowser.url",
  "dm4.webbrowser.web_resource",
  "dm4.webbrowser.web_resource_description",
  "dm4.webbrowser.webpage",
  "dm4.webclient.add_to_create_menu",
  "dm4.webclient.color",
  "dm4.webclient.editable",
  "dm4.webclient.icon",
  "dm4.webclient.is_searchable_unit",
  "dm4.webclient.js_field_renderer_class",
  "dm4.webclient.js_page_renderer_class",
  "dm4.webclient.rows",
  "dm4.webclient.search",
  "dm4.webclient.search_result",
  "dm4.webclient.search_term",
  "dm4.webclient.view_config",
  "dm4.webclient.viewable",
  "dm4.workspaces.description",
  "dm4.workspaces.name",
  "dm4.workspaces.workspace"
]

Association Types

Commands

Plugins