Class SpaceResource
- java.lang.Object
-
- com.atlassian.confluence.plugins.restapi.resources.SpaceResource
-
public class SpaceResource extends Object
REST wrapper for the SpaceService.
-
-
Constructor Summary
Constructors Constructor Description SpaceResource(SpaceService spaceService, RestNavigationService navigationService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<ContentType,RestList<Content>>
contents(String spaceKey, String depth, String expand, int start, int limit)
Returns the content in this given spaceRestList<Content>
contentsWithType(String spaceKey, String type, String depth, String expand, int start, int limit, javax.ws.rs.core.UriInfo uriInfo)
Returns the content in this given space with the given typeSpace
createPrivateSpace(Space newSpace)
Creates a new private Space, viewable only by its creator.Space
createSpace(Space newSpace)
Creates a new Space.javax.ws.rs.core.Response
delete(String spaceKey)
Deletes a Space.Space
space(String spaceKey, String expand)
Returns information about a space.PageResponse<Space>
spaces(String spaceKey, List<String> spaceKeys, String type, String status, List<String> labelNames, Boolean favourite, Boolean hasRetentionPolicy, String expand, int offset, String afterOffset, int limit, javax.ws.rs.core.UriInfo uriInfo)
Returns information about a number of spaces.Space
update(String spaceKey, Space space)
Updates a Space.
-
-
-
Constructor Detail
-
SpaceResource
public SpaceResource(SpaceService spaceService, RestNavigationService navigationService)
-
-
Method Detail
-
createSpace
@PublicApi public Space createSpace(Space newSpace) throws ServiceException
Creates a new Space.The incoming Space does not include an id, but must include a Key and Name, and should include a Description.
- Parameters:
newSpace
- the space to be created- Returns:
- the space created
- Throws:
ServiceException
-
createPrivateSpace
@PublicApi public Space createPrivateSpace(Space newSpace) throws ServiceException
Creates a new private Space, viewable only by its creator.The incoming Space does not include an id, but must include a Key and Name, and should include a Description.
- Parameters:
newSpace
- the space to be created- Returns:
- the space created
- Throws:
ServiceException
-
update
@PublicApi public Space update(String spaceKey, Space space) throws ServiceException
Updates a Space.
Currently only the Space name, description and homepage can be updated.
- Parameters:
spaceKey
- the key of the space to updatespace
- the space being updated- Returns:
- a JSON representation of the space, or a 404 NOT FOUND if there is no space with the given key or if the user is not permitted to update it.
- Throws:
ServiceException
-
delete
@PublicApi public javax.ws.rs.core.Response delete(String spaceKey) throws ServiceException, URISyntaxException
Deletes a Space.
The space is deleted in a long running task, so the space cannot be considered deleted when this resource returns. Clients can follow the status link in the response and poll it until the task completes.
- Parameters:
spaceKey
- the key of the space to delete- Returns:
- an accepted response containing a pointer to the status of the space-deletion task, or a 404 NOT FOUND if there is no space with the given key, or if the user is not permitted to delete it.
- Throws:
ServiceException
URISyntaxException
-
space
@PublicApi public Space space(String spaceKey, String expand)
Returns information about a space.
Example request URI(s):
http://example.com/confluence/rest/api/space/TST?expand=description
- Parameters:
spaceKey
- a string containing the key of the spaceexpand
- a comma separated list of properties to expand on the space- Returns:
- a JSON representation of a space, or a 404 if not found.
- Throws:
ServiceException
-
spaces
@PublicApi public PageResponse<Space> spaces(String spaceKey, List<String> spaceKeys, String type, String status, List<String> labelNames, Boolean favourite, Boolean hasRetentionPolicy, String expand, int offset, String afterOffset, int limit, @Context javax.ws.rs.core.UriInfo uriInfo) throws ServiceException
Returns information about a number of spaces.
Example request URI(s):
http://example.com/confluence/rest/api/space?spaceKey=TST&spaceKey=ds
- Parameters:
spaceKeys
- a list of space keysstatus
- filter the list of spaces returned by status (current, archived)type
- filter the list of spaces returned by type (global, personal)labelNames
- filter the list of spaces returned by labelfavourite
- filter the list of spaces returned by favouriteshasRetentionPolicy
- filter the list of spaces returned by retention policyfavouriteUserKey
- the key of the user whose favourites to filter by. Leave blank for the current userexpand
- a comma separated list of properties to expand on the spacesoffset
- the start point of the collection to returnlimit
- the limit of the number of spaces to return, this may be restricted by fixed system limitsuriInfo
- (injected) information about the request URI- Returns:
- an array of JSON representations of matching spaces, may be empty if no matches.
- Throws:
ServiceException
-
contents
@PublicApi public Map<ContentType,RestList<Content>> contents(String spaceKey, String depth, String expand, int start, int limit) throws ServiceException
Returns the content in this given space
Example request URI(s):
http://example.com/confluence/rest/api/space/TEST/content?expand=history
- Parameters:
spaceKey
- a string containing the key of the spacedepth
- a string indicating if all content, or just the root content of the space is returned. Default value:all
. Valid values:all, root
.expand
- a comma separated list of properties to expand on each piece of content retrievedstart
- the start point of the collection to returnlimit
- the limit of the number of labels to return, this may be restricted by fixed system limits- Returns:
- a JSON representation of the lists content, or an empty list if no content is found
- Throws:
ServiceException
-
contentsWithType
@PublicApi public RestList<Content> contentsWithType(String spaceKey, String type, String depth, String expand, int start, int limit, @Context javax.ws.rs.core.UriInfo uriInfo) throws ServiceException
Returns the content in this given space with the given type
Example request URI(s):
http://example.com/confluence/rest/api/space/TEST/content/page?expand=history
- Parameters:
spaceKey
- a string containing the key of the spacetype
- the type of content to return with the space. Valid values:page, blogpost
.depth
- a string indicating if all content, or just the root content of the space is returned. Default value:all
. Valid values:all, root
.expand
- a comma separated list of properties to expand on each piece of content retrievedstart
- the start point of the collection to returnlimit
- the limit of the number of labels to return, this may be restricted by fixed system limitsuriInfo
- (injected) information about the request URI- Returns:
- a JSON representation of the lists content, or an empty list if no content is found
- Throws:
ServiceException
-
-