-
Notifications
You must be signed in to change notification settings - Fork 10
REST: Templates related API
bugzmanov edited this page Aug 1, 2012
·
17 revisions
Lists only template names and versions.
Path: /rest/projects/(projectId)/templates
Type: GET
Example results
[
{
"name":"Erlang",
"version":"0.1"
},
{
"name":"XWiki",
"version":"0.1"
}
]Path parameters:
| Parameter | Type | Description |
|---|---|---|
| projectId | Number | id of the project. |
Path: /rest/projects/(projectId)/``templates/(templateName)/v(templateVersion)?format=src
Type: GET
Path parameters:
| Parameter | Type | Description |
|---|---|---|
| projectId | Number | id of the project. |
| templateName | String | name of the template |
| templateVersion | Number | version of the template |
Example results
{ "content": "come template content actually. might be long" }
## Get template description
Returns template name, version and create workflow variables descriptions
**Path:** `/rest/`projects/`(projectId)/``templates/(templateName)/v(templateVersion)`
**Type:** GET
**Path parameters:**
<table>
<tr>
<th>
Parameter
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
<tr>
<td>projectId</td>
<td>Number</td>
<td>id of the project.</td>
</tr>
<tr>
<td>
templateName
</td>
<td>
String
</td>
<td>
name of the template
</td>
</tr>
<tr>
<td>templateVersion</td>
<td>Number</td>
<td>version of the template</td>
</tr>
</table>
**Example results**:
``` json
{
"name": "Erlang",
"version": "0.1",
"createWorkflow":
{
"name": "create",
"variables":
[
{
"name": "nodesCount",
"description": "Erlang worker nodes count",
"optional": false,
"defaultValue": null,
"values":
{
}
}
]
}
}
## Partial apply: get values for dependent variablesВ
Partial apply returns list of variables ( with possible values ) that can be calculated based provided values. I.e. if B depends on A and C depends on B: if only A is provided, the result will contain possible values for A and B, if A and B are provided, all three variables will be returned
**Path:** `/rest/projects/(projectId)/templates/(templateName)/v(templateVersion)/(workflow)
**Type:** POST
**Request body: ** JSON array of variables (variables part of create environment request)
**Path parameters**:
<table>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>projectId</td>
<td>Number</td>
<td>Id of the project</td>
</tr>
<tr>
<td>templateName</td>
<td>String</td>
<td>name of the template</td>
</tr>
<tr>
<td>templateVersion</td>
<td>Number</td>
<td>version of the template</td>
</tr>
<tr>
<td>workflow</td>
<td>String</td>
<td>workflow name</td>
</tr>
</table>
**Example request:**
``` json
{"variables": { "imageId": 1 } }Example response (there is variables dependent from imageId in example request):
[
{
"name":"imageId",
"description":"image",
"values": [1,2]
},
{
"name":"nodesCount",
"description":"XWiki nodes count",
"optional": true,
"defaultValue": null,
"values": [1,2,3]
}
]