Class ContentLabelsResource
- java.lang.Object
-
- com.atlassian.confluence.plugins.restapi.resources.ContentLabelsResource
-
public class ContentLabelsResource extends Object
REST wrapper for theContentLabelService
.
-
-
Constructor Summary
Constructors Constructor Description ContentLabelsResource(ContentLabelService contentLabelService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PageResponse<Label>
addLabels(ContentId contentId, String labels)
Adds a list of labels to the specified content.javax.ws.rs.core.Response
deleteLabel(ContentId contentId, String label)
Deletes a labels to the specified content.javax.ws.rs.core.Response
deleteLabelWithQueryParam(ContentId contentId, String label)
Deletes a labels to the specified content.PageResponse<Label>
labels(ContentId contentId, List<String> prefixes, int offset, int limit, javax.ws.rs.core.UriInfo uriInfo)
Returns the list of labels on a piece of Content.
-
-
-
Constructor Detail
-
ContentLabelsResource
public ContentLabelsResource(ContentLabelService contentLabelService)
-
-
Method Detail
-
labels
@PublicApi public PageResponse<Label> labels(ContentId contentId, List<String> prefixes, int offset, int limit, @Context javax.ws.rs.core.UriInfo uriInfo) throws ServiceException
Returns the list of labels on a piece of Content.
Example request URI(s):
http://example.com/confluence/rest/api/content/1234/label
http://example.com/confluence/rest/api/content/1234/label?prefix=global&start=0&limit=200
- Parameters:
contentId
- a string containing the id of the labels content containerprefixes
- the prefixes to filter the labels with {@see Label.Prefix}start
- 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 labels on the content with the given id, or a 404 NOT FOUND if there is no content with the given id or if the user is not permitted. An empty list will be returned if there are no labels on the given content
- Throws:
ServiceException
-
addLabels
@PublicApi public PageResponse<Label> addLabels(ContentId contentId, String labels) throws ServiceException
Adds a list of labels to the specified content.
The body is the json representation of the list.
- Parameters:
contentId
- A string containing the id of the labels content containerlabels
- a single label object or a list of labels to add- Returns:
- a JSON representation of the existing and added labels on the content with the given id, or a 404 NOT FOUND if there is no content with the given id or if the user is not permitted. An empty list will be returned if there are no labels on the given content
- Throws:
ServiceException
-
deleteLabel
@PublicApi public javax.ws.rs.core.Response deleteLabel(ContentId contentId, String label) throws ServiceException
Deletes a labels to the specified content. When calling this method through REST the label parameter doesn't accept "/" characters in label names, because of security constraints. For this case please use the query parameter version of this method (/content/{id}/label?name={label}
- Parameters:
contentId
- A string containing the id of the labels content containerlabel
- the name of the label to be removed from the content- Returns:
- empty 204 response, or a 404 NOT FOUND if the content or label doens't exist if the user is not permitted to view the content.
- Throws:
ServiceException
-
deleteLabelWithQueryParam
@PublicApi public javax.ws.rs.core.Response deleteLabelWithQueryParam(ContentId contentId, String label) throws ServiceException
Deletes a labels to the specified content.
- Parameters:
contentId
- A string containing the id of the labels content containerlabel
- the name of the label to be removed from the content- Returns:
- empty 204 response, or a 404 NOT FOUND if the content or label doens't exist if the user is not permitted to view the content.
- Throws:
ServiceException
-
-