Skip to content

REST: Template Repository Configuration per project(since Genesis 1.3)

ddurnev edited this page Oct 1, 2012 · 1 revision

List all available template repository types(modes)

Path: /rest/template/repository/modes

Type: GET

Example results:

["git","classpath","filesystem"]

Returns all template repository types currently available in Genesis, depends on loaded plugins.

List all possible settings with default values for template repository type (mode)

Path: /rest/template/repository/modes/(mode) Mode should be one of the names returned by the template repository modes list, for example classpath.(See above)

Type: GET

Example results:

{
  "mode": "classpath",
  "configuration": [
    {
      "name": "genesis.template.repository.classpath.urls",
      "value": "NOT-SET!!!",
      "readOnly": false,
      "description": "Comma-separated list of Classloader URLs",
      "propertyType": {
        "name": "text"
      }
    },
    {
      "name": "genesis.template.repository.charset",
      "value": "UTF-8",
      "readOnly": false,
      "description": "Template content Character set",
      "propertyType": {
        "name": "text"
      }
    },
    {
      "name": "genesis.template.repository.wildcard",
      "value": "*.genesis",
      "readOnly": false,
      "description": "Template name wildcard",
      "propertyType": {
        "name": "text"
      }
    }
  ]
}

In case of incorrect mode is requested, 404 Not Found error(common result object) is returned:

{
  "serviceErrors": {},
  "variablesErrors": {},
  "compoundServiceErrors": [
    "No such template repository: cp"
  ],
  "compoundVariablesErrors": [],
  "isNotFound": true,
  "isSuccess": false
}

Get project template repository settings

Path: /rest/projects/(projectId)/template/repository

Type: GET

Example results:

{
  "mode": "filesystem",
  "configuration": [
    {
      "name": "genesis.template.repository.fs.path",
      "value": "templates",
      "readOnly": true,
      "description": "Local Filesystem path to take templates from",
      "propertyType": {
        "name": "text"
      }
    },
    {
      "name": "genesis.template.repository.wildcard",
      "value": "*.genesis",
      "readOnly": true,
      "description": "Template name wildcard",
      "propertyType": {
        "name": "text"
      }
    }
  ]
}

In case of incorrect projectId 404 Not Found error is returned:

{
  "serviceErrors": {},
  "variablesErrors": {},
  "compoundServiceErrors": [
    "Project [66] wasn't found"
  ],
  "compoundVariablesErrors": [],
  "isNotFound": true,
  "isSuccess": false
}

Update project template repository settings

Path: /rest/projects/(projectId)/template/repository

Type: PUT

Request body:

Input data:

{
 "genesis.template.repository.mode":"filesystem",
 "genesis.template.repository.fs.path":"templates",
 "genesis.template.repository.wildcard":"*.genesis"
}

Request body consists from a single JSON map contains the following entries:

Entry name Type Mandatory Description
genesis.template.repository.mode String Y Template repository mode name, should be one of the available modes
genesis.template.repository.mode.setting String N setting is One of the mode-specific setting names returned by possible settings list for mode
genesis.template.repository.setting String N One of the common settings returned by possible settings list for mode
Clone this wiki locally