Document Service

ResourceDescription
Attach attachmentAttach an attachment to the given text document.
Attach imageAttaches a image to the given document.
Create commentPosts a new comment on the specified content object.
Delete documentDeletes the document with the given id
Delete likeDeletes the user's like of the specified content object
Delete track
FollowStart following the specified comment content object.
Get attachmentsGets all attachments attached to the given document
Get binary bodyRetrieves the binary body of the document if the document has one
Get commentsReturns the latest comments for a given content object.
Get documentReturns the document with the given identifier.
Get document versionReturns the document version with the given identifier and version.
Get document versions
Get followerCheck if the user is following the specified comment content object
Get imagesReturns all images attached to the document with the given ID.
Get likeIndicates whether the user likes the specified content object.
Get likesGets a list of all users that like the specified content object
Get track
Get version binary bodyRetrieves the binary body of the document if the document has one
Get version imagesReturns all images attached to the document with the given ID and version.
LikeAdds a like to the specified content object
Read
Share
Track
UnfollowStop following the specified comment content object
Unread
Update binary bodyUpdates the binary body of the document.
Update documentUpdates the given document

Attach attachment

Attach an attachment to the given text document. Binary documents with cause a 403 response code to be returned as binary documents may not have attachments.

POST http://domain:port/application_context/api/core/v2/documents/{id}/attachments

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the document 

Post Payload

NameTypeDescriptionDefault Value
bodyMultipartBodythe multi-part body that contains the attachment binary 

Response

TypeDescription
Responsea HTTP 201 response including the URL for the uploaded attachment in the Location header

Attach image

Attaches a image to the given document.

POST http://domain:port/application_context/api/core/v2/documents/{id}/images

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the document 

Post Payload

NameTypeDescriptionDefault Value
bodyMultipartBodythe multi-part body that contains the image binary 

Response

TypeDescription
Responsea HTTP 201 response including the URL for the uploaded image in the Location header

Create comment

Posts a new comment on the specified content object.

POST http://domain:port/application_context/api/core/v2/documents/{id}/comments

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the content object 

Form Parameters

NameTypeDescriptionDefault Value
htmlDocumentParamthe HTML body of comment 

Response

TypeDescription
Responsea HTTP 201 response including the URL for the created comment in the Location header

Example

Form Payload
html=%3Cdiv+class%3D%22jive-rendered-content%22%3EFoobar%3C%2Fdiv%3E

Delete document

Deletes the document with the given id

DELETE http://domain:port/application_context/api/core/v2/documents/{id}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the document 

Response

TypeDescription
void

Delete like

Deletes the user's like of the specified content object

DELETE http://domain:port/application_context/api/core/v2/documents/{id}/likes/{userID}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the content object 
userIDlongthe system wide unique identifier for the user 

Response

TypeDescription
void

Delete track

DELETE http://domain:port/application_context/api/core/v2/documents/{id}/tracks/{userId}

Path Parameters

NameTypeDescriptionDefault Value
idlong 
userIdlong 

Response

TypeDescription
void

Follow

Start following the specified comment content object.

POST http://domain:port/application_context/api/core/v2/documents/{id}/followers

Path Parameters

NameTypeDescriptionDefault Value
idlongthe identifier of the comment content object to follow. 

Response

TypeDescription
Responsea HTTP 201 response including the URL for the subscription in the Location header

Get attachments

Gets all attachments attached to the given document

GET http://domain:port/application_context/api/core/v2/documents/{id}/attachments

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the document 

Response

TypeDescription
List of AttachmentEntitya collection of attachments attached to the document

Example

JSON Response Payload
[ {
  "name" : "test.png",
  "ref" : "http://localhost:50001/oc/v1/attachments/1004",
  "contentType" : "image/png",
  "size" : 12345
}, {
  "name" : "test.png",
  "ref" : "http://localhost:50001/oc/v1/attachments/1006",
  "contentType" : "text/plain",
  "size" : 2345
} ]

Get binary body

Retrieves the binary body of the document if the document has one

GET http://domain:port/application_context/api/core/v2/documents/{id}/binaryBody

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the document 

Response

TypeDescription
Responsethe binary body

Get comments

Returns the latest comments for a given content object. When excludeReplies is set to true the comments returned will be sorted by date from oldest to newest, otherwise the comments will be returned based on a pre-order, oldest first traversal of the comment tree, e.g. the following comment tree:
   1
   |-- 3
   |-- |-- 4
   |-- |-- |-- 7
   |-- |-- |-- |-- 10
   |-- |-- 6
   |-- |-- 8
   |-- 5
 
will result in comments ordered 1 3 4 7 10 6 8 5.

GET http://domain:port/application_context/api/core/v2/documents/{id}/comments?offset=int&limit=int&excludeReplies=boolean&sort=String&anchor=String

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the content object 

Query Parameters

NameTypeDescriptionDefault Value
offsetintthe number of results which should be skipped in the returned collection. For instance, if the first 25 results have already been retrieved then results after the 25th result can be retrieved by specifying an offset of 25. The minimum value for the offset is 0, specifying anything less than 0 for the offset will result in an exception."0"
limitintthe maximum number of comments to return. If there are fewer comments available in the given time period, if either after or before is provided, then fewer comments will be returned then the limit."25"
excludeRepliesbooleanwhether to only include top-level comments or not"false"
sortStringthe order in which the comments should be returned. Possible values are threaded and chronological. Defaults to chronological."chronological"
anchorStringoptional URI for a comment to anchor at. Specifying a anchor will try to return the page containing the anchor. If the anchor could not be found then the first page of comments will be returned. 

Response

TypeDescription
EntityCollectiona collection of comments on the content object.

Example

JSON Response Payload  (No Pagination)
TBD
  JSON Response (Pagination)
TBD

Get document

Returns the document with the given identifier. Each document in the system has a unique identifier which can be provided in order to retrieve it. Documents can only be retrieved by non-authors after they have been published, attempts to do so before they were published will result in a FORBIDDEN response from the server.

GET http://domain:port/application_context/api/core/v2/documents/{id}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the document 

Response

TypeDescription
Documentthe document with the given identifier.

Example

JSON Response Payload:
{
  "longitude" : -122.6805419921875,
  "latitude" : 45.52191162109375,
  "status" : "published",
  "creationDate" : 1280249784934,
  "modificationDate" : 1280249784934,
  "containerID" : null,
  "containerType" : null,
  "subject" : null,
  "text" : null,
  "author" : {
    "username" : "user-z4i5bqxrtqkta31g",
    "type" : 3,
    "id" : 2039,
    "links" : {
      "alt" : "http://localhost:50001/oc/v1/users/2010",
      "avatar" : "http://localhost:50001/oc/v1/avatars/default"
    }
  },
  "html" : "<body><!-- [DocumentBodyStart:f6f8ffca-6c96-49c3-a7f0-384be0ba53f8] --><div class=\"jive-rendered-content\"><span>UJraBCXbxc8IzfLVoH7ReluhX</span></div><!-- [DocumentBodyEnd:f6f8ffca-6c96-49c3-a7f0-384be0ba53f8] --></body>",
  "type" : 1464927464,
  "id" : 1034
}

Get document version

Returns the document version with the given identifier and version. Each document version in the system has a unique identifier and version which can be provided in order to retrieve it. Documents can only be retrieved by non-authors after they have been published, attempts to do so before they were published will result in a FORBIDDEN response from the server.

GET http://domain:port/application_context/api/core/v2/documents/{id}/versions/{version}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the document 
versionintthe version of the document to retrieve. Note that the version is only unique within the context of a particular document. 

Response

TypeDescription
Documentthe document with the given identifier.

Example

JSON Response Payload:
{
  "longitude" : -122.6805419921875,
  "latitude" : 45.52191162109375,
  "status" : "published",
  "creationDate" : 1280249784934,
  "modificationDate" : 1280249784934,
  "containerID" : null,
  "containerType" : null,
  "subject" : null,
  "text" : null,
  "author" : {
    "username" : "user-z4i5bqxrtqkta31g",
    "type" : 3,
    "id" : 2039,
    "links" : {
      "alt" : "http://localhost:50001/oc/v1/users/2010",
      "avatar" : "http://localhost:50001/oc/v1/avatars/default"
    }
  },
  "html" : "<body><!-- [DocumentBodyStart:f6f8ffca-6c96-49c3-a7f0-384be0ba53f8] --><div class=\"jive-rendered-content\"><span>UJraBCXbxc8IzfLVoH7ReluhX</span></div><!-- [DocumentBodyEnd:f6f8ffca-6c96-49c3-a7f0-384be0ba53f8] --></body>",
  "type" : 1464927464,
  "id" : 1034
}

Get document versions

GET http://domain:port/application_context/api/core/v2/documents/{id}/versions?offset=int&limit=int

Path Parameters

NameTypeDescriptionDefault Value
idlong 

Query Parameters

NameTypeDescriptionDefault Value
offsetint"0"
limitint"25"

Response

TypeDescription
EntityCollection

Get follower

Check if the user is following the specified comment content object

GET http://domain:port/application_context/api/core/v2/documents/{id}/followers/{userId}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe identifier of the comment content object to check for followers. 
userIdlongthe id of the follower to check for 

Response

TypeDescription
UserSummarythe user summary for the user if the user is following and a HTTP 404 response if the user is not following

Get images

Returns all images attached to the document with the given ID.

GET http://domain:port/application_context/api/core/v2/documents/{id}/images

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the document 

Response

TypeDescription
List of ImageEntitya collection of images attached to the document

Example

JSON Response Payload
[ {
  "size" : 16470,
  "ref" : "http://localhost:50001/oc/v1/images/1004",
  "contentType" : "image/png",
}, {
  "size" : 602438,
  "ref" : "http://localhost:50001/oc/v1/images/1006",
  "contentType" : "image/png",
} ]

Get like

Indicates whether the user likes the specified content object.

GET http://domain:port/application_context/api/core/v2/documents/{id}/likes/{userID}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the content object 
userIDlongthe system wide unique identifier for the user 

Response

TypeDescription
UserSummarythe user summary if the specified user likes the content object or a HTTP 404 if the user does not like the content object

Get likes

Gets a list of all users that like the specified content object

GET http://domain:port/application_context/api/core/v2/documents/{id}/likes

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the content object 

Response

TypeDescription
EntityCollectiona collection of user summaries for the users that like the content object

Example

JSON Response Payload
TBD

Get track

GET http://domain:port/application_context/api/core/v2/documents/{id}/tracks/{userId}

Path Parameters

NameTypeDescriptionDefault Value
idlong 
userIdlong 

Response

TypeDescription
UserSummary

Get version binary body

Retrieves the binary body of the document if the document has one

GET http://domain:port/application_context/api/core/v2/documents/{id}/versions/{version}/binaryBody

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the document 
versionintthe version of the binary body to return 

Response

TypeDescription
Responsethe binary body

Get version images

Returns all images attached to the document with the given ID and version.

GET http://domain:port/application_context/api/core/v2/documents/{id}/versions/{version}/images

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the document. 
versionintthe version of the document to return the images for. 

Response

TypeDescription
List of ImageEntitya collection of images attached to the document.

Example

JSON Response Payload
[ {
  "size" : 16470,
  "ref" : "http://localhost:50001/oc/v1/images/1004",
  "contentType" : "image/png",
}, {
  "size" : 602438,
  "ref" : "http://localhost:50001/oc/v1/images/1006",
  "contentType" : "image/png",
} ]

Like

Adds a like to the specified content object

POST http://domain:port/application_context/api/core/v2/documents/{id}/likes

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the content object 

Response

TypeDescription
Responsea HTTP 201 response including the URL for the "like" in the Location header. If this method is called more than once for the same authenticated user then a HTTP 403 status will be returned.

Read

POST http://domain:port/application_context/api/core/v2/documents/{id}/read

Path Parameters

NameTypeDescriptionDefault Value
idlong 

Response

TypeDescription
void

Share

POST http://domain:port/application_context/api/core/v2/documents/{id}/share

Path Parameters

NameTypeDescriptionDefault Value
idlong 

Form Parameters

NameTypeDescriptionDefault Value
htmlDocumentParam 
userURIsSet 

Response

TypeDescription
void

Track

POST http://domain:port/application_context/api/core/v2/documents/{id}/tracks

Path Parameters

NameTypeDescriptionDefault Value
idlong 

Response

TypeDescription
Response

Unfollow

Stop following the specified comment content object

DELETE http://domain:port/application_context/api/core/v2/documents/{id}/followers/{userId}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe identifier of the comment content object. 
userIdlongthe id of the following user to be removed. 

Response

TypeDescription
void

Unread

DELETE http://domain:port/application_context/api/core/v2/documents/{id}/read

Path Parameters

NameTypeDescriptionDefault Value
idlong 

Response

TypeDescription
void

Update binary body

Updates the binary body of the document. If the document has a text body it will be removed in favor of the binary body.

POST http://domain:port/application_context/api/core/v2/documents/{id}/binaryBody

Path Parameters

NameTypeDescriptionDefault Value
idlongsystem-wide uniqe identifier for the document being updated. 

Post Payload

NameTypeDescriptionDefault Value
bodyMultipartBodythe body of the document which is being updated. 

Response

TypeDescription
BinaryEntitythe updated document body.

Update document

Updates the given document

PUT http://domain:port/application_context/api/core/v2/documents/{id}?minorEdit=boolean

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the document 

Query Parameters

NameTypeDescriptionDefault Value
minorEditboolean"false"

Response

TypeDescription
Documentthe JSON representation of the document

Example

JSON Request Payload:
{
  "subject" : "Foo Subject",
  "content" : {
    "type" : "text/html",
    "text" : "<body>Foobar</body>"
  },
  "status" : "draft",
}
 JSON Response Payload
{
  "content" : {
    "type" : "text/html",
    "text" : "<body><!-- [DocumentBodyStart:293c64ef-1ab9-4b77-8dc5-bcb46b7b6525] --><div class=\"jive-rendered-content\">Foobar</div><!-- [DocumentBodyEnd:293c64ef-1ab9-4b77-8dc5-bcb46b7b6525] --></body>"
  },
  "version" : 2,
  "subject" : "Foo Subject",
  "status" : "draft",
  "author" : {
    "name" : "admin",
    "level" : {
      "name" : "Newbie",
      "points" : 5,
      "resources" : {
        "image" : {
          "ref" : "http://localhost:8080/api/core/v2/images/status/statusicon-47.gif",
          "allowed" : [ "GET" ]
        }
      }
    },
    "username" : "admin",
    "email" : "admin@example.com",
    "resources" : {
      "self" : {
        "ref" : "http://localhost:8080/api/core/v2/users/1",
        "allowed" : [ "GET" ]
      },
      "avatar" : {
        "ref" : "http://localhost:8080/api/core/v2/avatars/default",
        "allowed" : [ "GET" ]
      }
    },
    "id" : 1
  },
  "replyCount" : 0,
  "likeCount" : 0,
  "resources" : {
    "follower" : {
      "ref" : "http://localhost:8080/api/core/v2/documents/1001/followers",
      "allowed" : [ "POST" ]
    },
    "container" : {
      "ref" : "http://localhost:8080/api/core/v2/users/1",
      "allowed" : [ "GET" ]
    },
    "likes" : {
      "ref" : "http://localhost:8080/api/core/v2/documents/1001/likes",
      "allowed" : [ "GET" ]
    },
    "track" : {
      "ref" : "http://localhost:8080/api/core/v2/documents/1001/tracks/1",
      "allowed" : [ "GET", "DELETE" ]
    },
    "read" : {
      "ref" : "http://localhost:8080/api/core/v2/documents/1001/read",
      "allowed" : [ "POST" ]
    },
    "images" : {
      "ref" : "http://localhost:8080/api/core/v2/documents/1001/images",
      "allowed" : [ "GET" ]
    },
    "self" : {
      "ref" : "http://localhost:8080/api/core/v2/documents/1001",
      "allowed" : [ "GET", "PUT", "DELETE" ]
    },
    "html" : {
      "ref" : "http://localhost:8080/docs/DOC-1001",
      "allowed" : [ "GET" ]
    },
    "comments" : {
      "ref" : "http://localhost:8080/api/core/v2/documents/1001/comments",
      "allowed" : [ "GET", "POST" ]
    }
  },
  "id" : 1001,
  "creationDate" : "2011-12-07T18:16:59.958+0000",
  "modificationDate" : "2011-12-07T18:26:32.297+0000",
  "viewCount" : 2
}