Package com.xebialabs.xlrelease.api.v1

# Interface TemplateApi

All Superinterfaces:
  `ApiService`

@Path("/api/v1/templates") @Consumes("application/json") @Produces("application/json") public interface TemplateApi extends ApiService
Operations on templates.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `SERVICE_NAME`

  ### Fields inherited from interface com.xebialabs.xlrelease.api.ApiService

  `DEFAULT_RESULTS_PER_PAGE, DEFAULT_RESULTS_PER_PAGE_STRING, DEPTH, ORDER_BY, PAGE, PAGE_IS_OFFSET, RESULTS_PER_PAGE, ROLE_IDS_DATA`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Release`
  `copyTemplate(String templateId, CopyTemplate copyTemplate)`
  Makes a copy of the template on the current folder
  `default Release`
  `copyTemplate(String templateId, String title, String description)`
  Makes a copy of the template on the current folder
  `Release`
  `create(String templateId, CreateRelease createRelease)`
  Creates a release from a template.
  `Release`
  `createTemplate(Release template, String folderId)`
  Creates a template inside a folder.
  `Variable`
  `createVariable(String templateId, Variable variable)`
  Create a new variable.
  `void`
  `deleteTemplate(String templateId)`
  Deletes a template.
  `void`
  `deleteVariable(String variableId)`
  Delete variable from template.
  `jakarta.ws.rs.core.Response`
  `downloadTemplateLogo(String logoId)`
  `jakarta.ws.rs.core.Response`
  `exportTemplateToZip(String templateId)`
  Exports template as a zip download, in xlr format
  `List<String>`
  `getPermissions()`
  Returns possible permissions.
  `List<TeamView>`
  `getTeams(String templateId)`
  Returns effective teams of the template.
  `Release`
  `getTemplate(String templateId)`
  Returns the template for the given identifier.
  `List<Release>`
  `getTemplates(String filter)`
  Deprecated.
  Since 24.1.0.
  `default List<Release>`
  `getTemplates(String title, List<String> tags, Long page, Long resultsPerPage)`
  Returns the list of release templates that are visible to the current user.
  `default List<Release>`
  `getTemplates(String title, List<String> tags, Long page, Long resultsPerPage, Integer depth)`
  Deprecated.
  Since 24.1.0.
  `List<Release>`
  `getTemplates(String title, List<String> tags, String kind, Long page, Long resultsPerPage)`
  Returns the list of release or workflow templates that are visible to the current user.
  `List<Release>`
  `getTemplates(String title, List<String> tags, String kind, Long page, Long resultsPerPage, Integer depth)`
  Deprecated.
  Since 24.1.0.
  `Variable`
  `getVariable(String variableId)`
  Returns the variable for the given identifier.
  `Collection<Object>`
  `getVariablePossibleValues(String variableId)`
  Returns possible values for the variable with the given identifier.
  `List<Variable>`
  `getVariables(String templateId)`
  Get variables.
  `List<ImportResult>`
  `importTemplate(String json, String folderId)`
  Imports a template, serialized in JSON format.
  `List<ImportResult>`
  `importTemplate(String json, String folderId, String version)`
  Imports a template, serialized in JSON format.
  `List<ImportResult>`
  `importTemplateAsXlr(jakarta.servlet.http.HttpServletRequest request, String folderId)`
  Imports a template, serialized in XLR format, or a Releasefile (Releasefile.groovy) inside a .zip file.
  `Boolean`
  `isVariableUsed(String variableId)`
  Returns true if variable with the given identifier is used in the template.
  `void`
  `replaceVariable(String variableId, VariableOrValue variableOrValue)`
  Replace variable occurrences with the given replacement.
  `default String`
  `serviceName()`
  `List<TeamView>`
  `setTeams(String templateId, List<TeamView> teamDtos)`
  Sets teams of the template.
  `Release`
  `start(String templateId, StartRelease startRelease)`
  Starts a release from a template.
  `default Release`
  `updateTemplate(Release template)`
  Updates the properties of a template.
  `Release`
  `updateTemplate(String templateId, Release template)`
  Updates the properties of a template.
  `default Variable`
  `updateVariable(Variable variable)`
  Updates the properties of a variable.
  `Variable`
  `updateVariable(String variableId, Variable variable)`
  `List<Variable>`
  `updateVariables(String releaseId, List<Variable> variables)`
  Update the variable list.

- ## Field Details

  - ### SERVICE_NAME

    static final String SERVICE_NAME
    See Also:
      - Constant Field Values

- ## Method Details

  - ### serviceName

    default String serviceName()
    Specified by:
      `serviceName` in interface `ApiService`

  - ### getTemplates

    @Deprecated(since="24.1.0") @GET List<Release> getTemplates(@QueryParam("title") String title, @QueryParam("tag") List<String> tags, @DefaultValue("RELEASE") @QueryParam("kind") String kind, @DefaultValue("0") @QueryParam("page") Long page, @DefaultValue("100") @QueryParam("resultsPerPage") Long resultsPerPage, @DefaultValue("1") @QueryParam("depth") Integer depth)
    Deprecated.
    Since 24.1.0. Please use `getTemplates(String, List, String, Long, Long)`
    Returns the list of release or workflow templates that are visible to the current user.
    Parameters:
      `title` - an optional search filter containing the title of the template.
      `tags` - an optional search filter containing list of template tags.
      `kind` - the kind of template. Default value is release.
      `page` - the page of results to return. Default value is 0.
      `resultsPerPage` - the number of results per page. Default value is 100. Maximum value is 100.
      `depth` - the depth to search for. Default value is 1.
    Returns:
      a list of release templates.

  - ### getTemplates

    @Deprecated(since="24.1.0") default List<Release> getTemplates(String title, List<String> tags, Long page, Long resultsPerPage, Integer depth)
    Deprecated.
    Since 24.1.0. Please use `getTemplates(String, List, Long, Long)`
    Returns the list of release templates that are visible to the current user.
    Parameters:
      `title` - an optional search filter containing the title of the template.
      `tags` - an optional search filter containing list of template tags.
      `page` - the page of results to return. Default value is 0.
      `resultsPerPage` - the number of results per page. Default value is 100. Maximum value is 100.
      `depth` - the depth to search for. Default value is 1.
    Returns:
      a list of release templates.

  - ### getTemplates

    @GET List<Release> getTemplates(@QueryParam("title") String title, @QueryParam("tag") List<String> tags, @DefaultValue("RELEASE") @QueryParam("kind") String kind, @DefaultValue("0") @QueryParam("page") Long page, @DefaultValue("100") @QueryParam("resultsPerPage") Long resultsPerPage)
    Returns the list of release or workflow templates that are visible to the current user.
    Parameters:
      `title` - an optional search filter containing the title of the template.
      `tags` - an optional search filter containing list of template tags.
      `kind` - the kind of template. Default value is release.
      `page` - the page of results to return. Default value is 0.
      `resultsPerPage` - the number of results per page. Default value is 100. Maximum value is 100.
    Returns:
      a list of release templates.

  - ### getTemplates

    default List<Release> getTemplates(String title, List<String> tags, Long page, Long resultsPerPage)
    Returns the list of release templates that are visible to the current user.
    Parameters:
      `title` - an optional search filter containing the title of the template.
      `tags` - an optional search filter containing list of template tags.
      `page` - the page of results to return. Default value is 0.
      `resultsPerPage` - the number of results per page. Default value is 100. Maximum value is 100.
    Returns:
      a list of release templates.

  - ### getTemplates

    @Deprecated(since="24.1.0") List<Release> getTemplates(String filter)
    Deprecated.
    Since 24.1.0. Please use `getTemplates(String, List, Long, Long)`
    Returns the list of the first 100 release templates that are visible to the current user.
    Parameters:
      `filter` - An optional search filter containing the title of the template

  - ### updateTemplate

    @PUT @Path("/{templateId:.*Release[^/]*}") Release updateTemplate(@PathParam("templateId") String templateId, Release template)
    Updates the properties of a template.
    Parameters:
      `templateId` - the template identifier.
      `template` - new contents of the template.
    Returns:
      the updated release template.

  - ### updateTemplate

    default Release updateTemplate(Release template)
    Updates the properties of a template.
    Parameters:
      `template` - new contents of the template.
    Returns:
      the updated release template.

  - ### createTemplate

    @POST Release createTemplate(Release template, @QueryParam("folderId") String folderId)
    Creates a template inside a folder.

    All nested configuration items (e.g. phases, tasks, teams) will be removed from the provided template, you can use corresponding phaseApi or taskApi for those.

    Parameters:
      `template` - the contents of the release template.
      `folderId` - an optional parameter to create a template inside a folder
    Returns:
      the created template.

  - ### importTemplate

    @POST @Path("/import") @Consumes("application/json") List<ImportResult> importTemplate(String json, @QueryParam("folderId") String folderId, @QueryParam("version") String version)
    Imports a template, serialized in JSON format.
    Parameters:
      `json` - JSON representation of the template.
      `folderId` - the target folder.
      `version` - the version of the template. (optional)
    Returns:
      the newly created release template

  - ### importTemplate

    List<ImportResult> importTemplate(String json, String folderId)
    Imports a template, serialized in JSON format.
    Parameters:
      `json` - JSON representation of the template.
      `folderId` - the target folder.
    Returns:
      the newly created release template

  - ### importTemplateAsXlr

    @POST @Path("/import") @Consumes("multipart/form-data") List<ImportResult> importTemplateAsXlr(@Context jakarta.servlet.http.HttpServletRequest request, @QueryParam("folderId") String folderId) throws IOException
    Imports a template, serialized in XLR format, or a Releasefile (Releasefile.groovy) inside a .zip file.
    Parameters:
      `request` - the HttpServletRequest
    Returns:
      the newly created release template
    Throws:
      `IOException`

  - ### getTemplate

    @GET @Path("/{templateId:.*Release[^/]*}") Release getTemplate(@PathParam("templateId") String templateId)
    Returns the template for the given identifier.
    Parameters:
      `templateId` - the template identifier.
    Returns:
      the release template.

  - ### deleteTemplate

    @DELETE @Path("/{templateId:.*Release[^/]*}") void deleteTemplate(@PathParam("templateId") String templateId)
    Deletes a template.
    Parameters:
      `templateId` - the template identifier

  - ### create

    @POST @Path("/{templateId:.*Release[^/]*}/create") Release create(@PathParam("templateId") String templateId, CreateRelease createRelease)
    Creates a release from a template.
    Parameters:
      `templateId` - the template identifier of the template the release is based on.
      `createRelease` - the parameters for the new release.
    Returns:
      the newly created release.

  - ### start

    @POST @Path("/{templateId:.*Release[^/]*}/start") Release start(@PathParam("templateId") String templateId, StartRelease startRelease)
    Starts a release from a template.
    Parameters:
      `templateId` - the template identifier of the template the release is based on.
      `startRelease` - the parameters for the new release.
    Returns:
      the newly created and started release.

  - ### getVariables

    @GET @Path("/{templateId:.*Release[^/]*}/variables") List<Variable> getVariables(@PathParam("templateId") String templateId)
    Get variables.
    Parameters:
      `templateId` - the identifier of the release or template.
    Returns:
      a list of variables.

  - ### getVariable

    @GET @Path("/{variableId:.*/Variable[^/]*}") Variable getVariable(@PathParam("variableId") String variableId)
    Returns the variable for the given identifier.
    Parameters:
      `variableId` - the identifier of the variable.
    Returns:
      the variable.

  - ### getVariablePossibleValues

    @GET @Path("/{variableId:.*/Variable[^/]*}/possibleValues") Collection<Object> getVariablePossibleValues(@PathParam("variableId") String variableId)
    Returns possible values for the variable with the given identifier.
    Parameters:
      `variableId` - the variable identifier.
    Returns:
      possible values for the variable.

  - ### isVariableUsed

    @GET @Path("/{variableId:.*/Variable[^/]*}/used") Boolean isVariableUsed(@PathParam("variableId") String variableId)
    Returns true if variable with the given identifier is used in the template.
    Parameters:
      `variableId` - the variable ID.
    Returns:
      true if variable with the given identifier is used in the template.

  - ### replaceVariable

    @POST @Path("/{variableId:.*/Variable[^/]*}/replace") void replaceVariable(@PathParam("variableId") String variableId, VariableOrValue variableOrValue)
    Replace variable occurrences with the given replacement.
    Parameters:
      `variableId` - the variable ID.
      `variableOrValue` - an object with a variable or value replacing the initial variable.

  - ### deleteVariable

    @DELETE @Path("/{variableId:.*/Variable[^/]*}") void deleteVariable(@PathParam("variableId") String variableId)
    Delete variable from template.
    Parameters:
      `variableId` - the variable ID.

  - ### createVariable

    @POST @Path("/{templateId:.*Release[^/]*}/variables") Variable createVariable(@PathParam("templateId") String templateId, Variable variable)
    Create a new variable.
    Parameters:
      `templateId` - the identifier of a template.
      `variable` - the `Variable` object describing the new variable.
    Returns:
      created `Variable` object.

  - ### updateVariables

    @PUT @Path("/{releaseId:.*Release[^/]*}/variables") List<Variable> updateVariables(@PathParam("releaseId") String releaseId, List<Variable> variables)
    Update the variable list.
    Parameters:
      `releaseId` - the identifier of the release.
      `variables` - the variable list to update.
    Returns:
      updated variables.

  - ### updateVariable

    @PUT @Path("/{variableId:.*/Variable[^/]*}") Variable updateVariable(@PathParam("variableId") String variableId, Variable variable)

  - ### updateVariable

    default Variable updateVariable(Variable variable)
    Updates the properties of a variable.
    Parameters:
      `variable` - new contents of the variable.
    Returns:
      the updated variable.

  - ### getPermissions

    @GET @Path("/permissions") List<String> getPermissions()
    Returns possible permissions.
    Returns:
      list of permissions for templates and releases

  - ### getTeams

    @GET @Path("/{templateId:.*Release[^/]*}/teams") List<TeamView> getTeams(@PathParam("templateId") String templateId)
    Returns effective teams of the template.
    Parameters:
      `templateId` - the identifier of the template
    Returns:
      a list of effective teams

  - ### setTeams

    @POST @Path("/{templateId:.*Release[^/]*}/teams") List<TeamView> setTeams(@PathParam("templateId") String templateId, List<TeamView> teamDtos)
    Sets teams of the template.
    Parameters:
      `templateId` - the identifier of the template
    Returns:
      a list of updated teams

  - ### exportTemplateToZip

    @GET @Path("zip/{templateId:.*Release[^/]*}") @Produces("application/octet-stream") jakarta.ws.rs.core.Response exportTemplateToZip(@PathParam("templateId") String templateId)
    Exports template as a zip download, in xlr format
    Parameters:
      `templateId` - the identifier of the template
    Returns:
      zip archive of template

  - ### copyTemplate

    @POST @Path("/{templateId:.*Release[^/]*}/copy") Release copyTemplate(@PathParam("templateId") String templateId, CopyTemplate copyTemplate)
    Makes a copy of the template on the current folder
    Parameters:
      `templateId` - : the full templateID: Applications/FolderXXXX/ReleaseYYYY
      `copyTemplate` - : new properties of the template
    Returns:
      the new template
    Since:
      10.0

  - ### copyTemplate

    default Release copyTemplate(String templateId, String title, String description)
    Makes a copy of the template on the current folder
    Parameters:
      `templateId` - : the full templateID: Applications/FolderXXXX/ReleaseYYYY
      `title` - : the new template title
      `description` - : the new template description
    Returns:
      the new template
    Since:
      10.0

  - ### downloadTemplateLogo

    @GET @Path("logo/{logoId:.*/TemplateLogo[^/]*}") @Produces("application/octet-stream") jakarta.ws.rs.core.Response downloadTemplateLogo(@PathParam("logoId") String logoId) throws IOException
    Throws:
      `IOException`