Class ContentPropertyResource

java.lang.Object
com.atlassian.confluence.plugins.restapi.resources.ContentPropertyResource

@PublicApi public class ContentPropertyResource extends Object

A REST resource for manipulating content properties.

Content properties are a key / value store of properties attached to a piece of Content. The key is a string, and the value is a JSON object.

Since:
5.6
  • Constructor Details

  • Method Details

    • create

      public JsonContentProperty create(ContentId contentId, JsonContentProperty newProperty) throws ServiceException

      Creates a new content property.

      Parameters:
      contentId - the content to attach the property to
      newProperty - content property to be created
      Returns:
      content property created
      Throws:
      ServiceException
    • create

      public JsonContentProperty create(ContentId contentId, String key, JsonContentProperty newProperty) throws ServiceException

      Creates a new content property.

      Parameters:
      contentId - the content to attach the property to
      key - the key of the content property. Required.
      newProperty - content property to be created
      Returns:
      content property created
      Throws:
      ServiceException
    • findAll

      public RestList<JsonContentProperty> findAll(ContentId contentId, String expand, int start, int limit, @Context javax.ws.rs.core.UriInfo uriInfo) throws ServiceException

      Returns a paginated list of content properties.

      Example request URI:

      • http://example.com/confluence/rest/api/content/1234/property?expand=content,version
      Parameters:
      contentId - the content to find properties under. Required.
      expand - a comma separated list of properties to expand on the content properties. Default value: version.
      start - the start point of the collection to return
      limit - the limit of the number of items to return, this may be restricted by fixed system limits
      uriInfo - (injected) information about the request URI
      Returns:
      a JSON representation of the content properties, or a 404 NOT FOUND if there is no content with the given id or if the user is not permitted.
      Throws:
      ServiceException
    • findByKey

      public JsonContentProperty findByKey(ContentId contentId, String key, String expand) throws ServiceException

      Returns a content property.

      Example request URI:

      • http://example.com/confluence/rest/api/content/1234/property/example-property-key?expand=content,version
      Parameters:
      contentId - the content to find the property under. Required.
      key - the key of the content property. Required.
      expand - a comma separated list of properties to expand on the content properties. Default value: version.
      Returns:
      a JSON representation of the content property, or a 404 NOT FOUND if there is no content with the given id, or no property with the given key, or if the user is not permitted.
      Throws:
      ServiceException
    • update

      public JsonContentProperty update(ContentId contentId, String key, JsonContentProperty property) throws IOException, ServiceException

      Updates a content property.

      The body contains the representation of the content property. Must include the property id, and the new version number. Attempts to create a new content property if the given version number is 1, just like create(com.atlassian.confluence.api.model.content.id.ContentId, String, com.atlassian.confluence.api.model.content.JsonContentProperty).

      Parameters:
      contentId - the id of the content
      key - the key of the property
      property - the content property being updated
      Returns:
      a JSON representation of the content property, or a 404 NOT FOUND if there is no content with the given id, or no property with the given key, or if the user is not permitted.
      Throws:
      ServiceException
      IOException
    • delete

      public javax.ws.rs.core.Response delete(ContentId contentId, String key) throws ServiceException

      Deletes a content property.

      Parameters:
      contentId - the id of the content
      key - the key of the property
      Throws:
      ServiceException