Class SpaceResource


  • public class SpaceResource
    extends Object
    REST wrapper for the SpaceService.
    • 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 update
        space - 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 space
        expand - 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 keys
        status - 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 label
        favourite - filter the list of spaces returned by favourites
        hasRetentionPolicy - filter the list of spaces returned by retention policy
        favouriteUserKey - the key of the user whose favourites to filter by. Leave blank for the current user
        expand - a comma separated list of properties to expand on the spaces
        offset - the start point of the collection to return
        limit - the limit of the number of spaces to return, this may be restricted by fixed system limits
        uriInfo - (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 space
        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 retrieved
        start - the start point of the collection to return
        limit - 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 space
        type - 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 retrieved
        start - the start point of the collection to return
        limit - the limit of the number of labels to return, this may be restricted by fixed system limits
        uriInfo - (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