Class ContentResource
java.lang.Object
com.atlassian.confluence.plugins.restapi.resources.ContentResource
@Consumes("application/json")
@Produces("application/json")
@Path("/content")
public class ContentResource
extends Object
REST wrapper for the ContentService. Provides methods for finding, creating, modifying and deleting Content.
-
Constructor Summary
ConstructorsConstructorDescriptionContentResource
(ContentService contentService, SpaceService spaceService, ContentMacroService contentMacroService, ContentTrashService contentTrashService, CQLSearchService searchService, ContentDraftService contentDraftService, ObjectMapperProvider objectMapperProvider) -
Method Summary
Modifier and TypeMethodDescriptioncreateContent
(Content content, ContentStatus status, String expand) javax.ws.rs.core.Response
delete
(ContentId contentId, ContentStatus status) getContent
(String type, String spaceKey, String title, List<ContentStatus> statuses, String postingDay, String expand, int start, int limit, List<String> ids, javax.ws.rs.core.UriInfo uriInfo) getContentByGraph
(ContentId id, String expand, String type, String spaceKey, String title, String postingDay, List<ContentStatus> statuses, Integer version, int offset, String afterOffset, int limit, javax.ws.rs.core.UriInfo uriInfo) getContentById
(ContentId id, List<ContentStatus> statuses, Integer version, String expand) getHistory
(ContentId contentId, String expand) getMacroBodyByHash
(ContentId contentId, int versionId, String hash) Deprecated.getMacroBodyByMacroId
(ContentId contentId, int versionId, String macroId) scanContent
(String spaceKey, List<ContentStatus> statuses, String expand, int limit, String cursor, String type, javax.ws.rs.core.UriInfo uriInfo) search
(String cql, String cqlcontext, String expand, int start, int limit, javax.ws.rs.core.UriInfo uriInfo) update
(ContentId contentId, Content content, ContentStatus status, ContentDraftService.ConflictPolicy conflictPolicy, boolean asyncReconciliation)
-
Constructor Details
-
ContentResource
@Inject public ContentResource(ContentService contentService, SpaceService spaceService, ContentMacroService contentMacroService, ContentTrashService contentTrashService, CQLSearchService searchService, ContentDraftService contentDraftService, ObjectMapperProvider objectMapperProvider)
-
-
Method Details
-
getContentByGraph
public PageResponse<Content> getContentByGraph(ContentId id, String expand, @DefaultValue("page") String type, String spaceKey, String title, String postingDay, List<ContentStatus> statuses, @DefaultValue("0") Integer version, @DefaultValue("0") int offset, String afterOffset, @DefaultValue("25") int limit, javax.ws.rs.core.UriInfo uriInfo) -
getContentById
@PublicApi @GET @Path("/{id}") public Content getContentById(@DefaultValue("") @PathParam("id") ContentId id, @QueryParam("status") List<ContentStatus> statuses, @QueryParam("version") Integer version, @QueryParam("expand") @DefaultValue("history,space,version") String expand) throws ServiceException - Throws:
ServiceException
-
createContent
@PublicApi @POST public Content createContent(Content content, @QueryParam("status") @DefaultValue("current") ContentStatus status, @QueryParam("expand") @DefaultValue("body.storage,history,space,container.history,container.version,version,ancestors") String expand) throws ServiceException - Throws:
ServiceException
-
getContent
@PublicApi @GET public PageResponse<Content> getContent(@QueryParam("type") @DefaultValue("page") String type, @QueryParam("spaceKey") String spaceKey, @QueryParam("title") String title, @QueryParam("status") List<ContentStatus> statuses, @QueryParam("postingDay") String postingDay, @QueryParam("expand") @DefaultValue("") String expand, @QueryParam("start") int start, @QueryParam("limit") @DefaultValue("25") int limit, @QueryParam("ids") List<String> ids, @Context javax.ws.rs.core.UriInfo uriInfo) throws ServiceException - Throws:
ServiceException
-
scanContent
@PublicApi @GET @Path("/scan") public PageResponse<Content> scanContent(@QueryParam("spaceKey") String spaceKey, @QueryParam("status") List<ContentStatus> statuses, @QueryParam("expand") @DefaultValue("") String expand, @QueryParam("limit") @DefaultValue("25") int limit, @QueryParam("cursor") String cursor, @QueryParam("type") String type, @Context javax.ws.rs.core.UriInfo uriInfo) throws ServiceException - Throws:
ServiceException
-
search
@PublicApi @GET @Path("/search") public PageResponse<Content> search(@QueryParam("cql") String cql, @QueryParam("cqlcontext") String cqlcontext, @QueryParam("expand") @DefaultValue("") String expand, @QueryParam("start") int start, @QueryParam("limit") @DefaultValue("25") int limit, @Context javax.ws.rs.core.UriInfo uriInfo) -
getHistory
@PublicApi @GET @Path("/{id}/history") @Consumes("application/json") public History getHistory(@PathParam("id") ContentId contentId, @QueryParam("expand") @DefaultValue("previousVersion,nextVersion,lastUpdated") String expand) throws ServiceException - Throws:
ServiceException
-
getMacroBodyByHash
@Deprecated @PublicApi @GET @Consumes("application/json") @Path("/{id}/history/{version}/macro/hash/{hash}") public MacroInstance getMacroBodyByHash(@PathParam("id") ContentId contentId, @PathParam("version") int versionId, @PathParam("hash") String hash) throws ServiceException Deprecated.- Throws:
ServiceException
-
getMacroBodyByMacroId
@PublicApi @GET @Consumes("application/json") @Path("/{id}/history/{version}/macro/id/{macroId}") public MacroInstance getMacroBodyByMacroId(@PathParam("id") ContentId contentId, @PathParam("version") int versionId, @PathParam("macroId") String macroId) throws ServiceException - Throws:
ServiceException
-
update
@PublicApi @PUT @Path("/{contentId}") public Content update(@PathParam("contentId") ContentId contentId, Content content, @QueryParam("status") ContentStatus status, @QueryParam("conflictPolicy") @DefaultValue("abort") ContentDraftService.ConflictPolicy conflictPolicy, @QueryParam("asyncReconciliation") @DefaultValue("false") boolean asyncReconciliation) throws ServiceException - Throws:
ServiceException
-
delete
@PublicApi @DELETE @Path("/{id}") public javax.ws.rs.core.Response delete(@PathParam("id") ContentId contentId, @QueryParam("status") ContentStatus status) throws ServiceException - Throws:
ServiceException
-