Class ContentVersionResource
java.lang.Object
com.atlassian.confluence.plugins.restapi.experimental.resources.ContentVersionResource
@ExperimentalApi
@Consumes("application/json")
@Produces("application/json")
@Path("/content/{id}/version")
public class ContentVersionResource
extends Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteContentHistory
(ContentId contentId, int versionNumber) Delete a historical version.getContentHistory
(ContentId contentId, int start, int limit, String expand, javax.ws.rs.core.UriInfo uriInfo) Get list of content versions in version descending order.getContentVersion
(ContentId contentId, int versionNumber, String expand) Get a version of the content with option to expand on content and its sub fields, by default it expands content on version.restoreContentHistory
(ContentId contentId, RestData restData, String expand) Restore a historical version to be a new current version.
-
Constructor Details
-
ContentVersionResource
-
-
Method Details
-
getContentHistory
@GET public PageResponse<Version> getContentHistory(@PathParam("id") ContentId contentId, @QueryParam("start") int start, @QueryParam("limit") @DefaultValue("200") int limit, @QueryParam("expand") @DefaultValue("") String expand, @Context javax.ws.rs.core.UriInfo uriInfo) Get list of content versions in version descending order. ContentId must exist and current user must have view permission on this content. This is validated and exception will throw if they are not satisfied.- Parameters:
contentId
- contentId of the CURRENT content entity, NOT the historical ones. As this is the only contentId visible to user.start
-limit
-expand
-uriInfo
-- Returns:
- the versions for the given start and limit
-
getContentVersion
@GET @Path("{versionNumber}") public Version getContentVersion(@PathParam("id") ContentId contentId, @PathParam("versionNumber") int versionNumber, @QueryParam("expand") @DefaultValue("content") String expand) Get a version of the content with option to expand on content and its sub fields, by default it expands content on version.- Parameters:
contentId
-versionNumber
-expand
-- Returns:
- the version
-
deleteContentHistory
@DELETE @Path("/{versionId}") public void deleteContentHistory(@PathParam("id") ContentId contentId, @PathParam("versionId") int versionNumber) Delete a historical version. Current user must have edit permission on content, or it will throw a permission exception.- Parameters:
contentId
-versionNumber
- version number starts from 1 up to current version.
-
restoreContentHistory
@POST public Version restoreContentHistory(@PathParam("id") ContentId contentId, RestData restData, @QueryParam("expand") @DefaultValue("content") String expand) Restore a historical version to be a new current version. The result is a new version is created with the content of the historical version.- Parameters:
contentId
-restData
- wrapper object wrappers detailed parameters for this operation.expand
- Expansion on newly create current version- Returns:
- The newly created version.
-