| 310 | === Create a topic type === |
| 311 | |
| 312 | {{{ |
| 313 | POST /core/topictype |
| 314 | |
| 315 | <the topic type to create> |
| 316 | }}} |
| 317 | |
| 318 | For details about the topic type format see DataFormat#TopicType. |
| 319 | |
| 320 | For a create operation not all of the topic type's properties are involved: |
| 321 | |
| 322 | ||= Property =||= Mandatory / Optional =|| |
| 323 | || `uri` || Optional. Default URI is `domain.project.topic_type_<ID>`. You can change the URI later on through an update operation. However, the URI is typically specified at topic type creation time. || |
| 324 | || `value` || Optional. Default topic type name is an empty string. You can change the name later on through an update operation. However, the name is typically specified at topic type creation time. || |
| 325 | || `data_type_uri` || Mandatory. || |
| 326 | || `index_mode_uris` || Optional. Default is no indexing. || |
| 327 | || `assoc_defs` || For complex topic types: Optional. Default is no child types. You can add child types later on through an update operation. However, the child types are typically specified at topic type creation time.\\\\For simple topic types: Do //not// specify child types. || |
| 328 | || `view_config_topics` || Optional. Default is no view models. || |
| 329 | |
| 330 | ==== Example 1: Creating a simple topic type ==== |
| 331 | |
| 332 | {{{ |
| 333 | curl localhost:8080/core/topictype -i \ |
| 334 | -X POST \ |
| 335 | -H Content-Type:application/json \ |
| 336 | -d '{uri: "spaceorg.planetarium.planet", |
| 337 | value: "Planet", |
| 338 | data_type_uri: "dm4.core.text"}' \ |
| 339 | | jsonpretty |
| 340 | }}} |
| 341 | |
| 342 | Response: |
| 343 | |
| 344 | {{{ |
| 345 | HTTP/1.1 200 OK |
| 346 | Content-Type: application/json |
| 347 | |
| 348 | { |
| 349 | "id": 3505, |
| 350 | "uri": "spaceorg.planetarium.planet", |
| 351 | "type_uri": "dm4.core.topic_type", |
| 352 | "value": "Planet", |
| 353 | "composite": { |
| 354 | }, |
| 355 | "data_type_uri": "dm4.core.text", |
| 356 | "index_mode_uris": [ |
| 357 | |
| 358 | ], |
| 359 | "assoc_defs": [ |
| 360 | |
| 361 | ], |
| 362 | "view_config_topics": [ |
| 363 | |
| 364 | ] |
| 365 | } |
| 366 | }}} |
| 367 | |