Post Service
Attach attachment
Attach an attachment to the given blog post.
POST http://domain:port/application_context/api/core/v2/posts/{id}/attachments
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the blog post | |
Post Payload
Name | Type | Description | Default Value |
---|
body | MultipartBody | the multi-part body that contains the attachment binary | |
Response
Type | Description |
---|
Response | a HTTP 201 response including the URL for the uploaded attachment in the Location header. |
Attach image
Attaches a image to the given blog post.
POST http://domain:port/application_context/api/core/v2/posts/{id}/images
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the blog post | |
Post Payload
Name | Type | Description | Default Value |
---|
body | MultipartBody | the multi-part body that contains the image binary | |
Response
Type | Description |
---|
Response | a HTTP 201 response including the URL for the uploaded image in the Location header |
Posts a new comment on the specified content object.
POST http://domain:port/application_context/api/core/v2/posts/{id}/comments
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the content object | |
Form Parameters
Name | Type | Description | Default Value |
---|
html | DocumentParam | the HTML body of comment | |
Response
Type | Description |
---|
Response | a 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 blog post
Deletes the blog post with the given id. Unauthorized can be returned in the case when the authenticated user is
unauthorized to delete the post.
DELETE http://domain:port/application_context/api/core/v2/posts/{id}
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the blog post | |
Delete like
Deletes the user's like of the specified content object
DELETE http://domain:port/application_context/api/core/v2/posts/{id}/likes/{userID}
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the content object | |
userID | long | the system wide unique identifier for the user | |
Delete track
DELETE http://domain:port/application_context/api/core/v2/posts/{id}/tracks/{userId}
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | | |
userId | long | | |
Follow
Start following the specified comment content object.
POST http://domain:port/application_context/api/core/v2/posts/{id}/followers
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the identifier of the comment content object to follow. | |
Response
Type | Description |
---|
Response | a HTTP 201 response including the URL for the subscription in the Location header |
Get attachments
Gets all attachments attached to the given blog post
GET http://domain:port/application_context/api/core/v2/posts/{id}/attachments
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the blog post | |
Response
Type | Description |
---|
List of AttachmentEntity | a collection of attachments attached to the blog post |
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 blog post
Returns the blog post with the given identifier. Each blog post in the system has a unique identifier which can
be provided in order to retrieve it. Blog posts 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/posts/{id}
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the blog post | |
Response
Type | Description |
---|
Post | the blog post with the given identifier. |
Example
JSON Response Payload:
{
"published" : "2011-08-02T23:26:14.272+0000",
"content" : {
"type" : "text/html",
"text" : "<body><!-- [DocumentBodyStart:5abefa57-35fe-4286-86b9-91e1a4ee6533] --><div class=\"jive-rendered-content\"><p>HHo4ENTeAuojTwfIJfCcXyP0TpPk1V1WGLqAfWvtfgNzsm8VOF5INmXtC5X7Bosf7exjTHhNzBH5fd2bdxBs6rTw5SYmKJTschnngfiTxs9ik7b5x4oQOWLfr4C7jBWngArYKiAQT0kEql12cvEogk</p></div><!-- [DocumentBodyEnd:5abefa57-35fe-4286-86b9-91e1a4ee6533] --></body>"
},
"status" : "published",
"subject" : "8HuZWHNYWAlbQlOvVHDfyqIgMh1Fs3wKfsO",
"author" : {
"name" : "user-bNg0WFa6nE4A37Px",
"level" : {
"name" : "Newbie",
"points" : 3,
"resources" : {
"image" : {
"ref" : "http://localhost:50001/core/v1/images/status/statusicon-47.gif",
"allowed" : [ "GET" ]
}
}
},
"username" : "user-bng0wfa6ne4a37px",
"resources" : {
"self" : {
"ref" : "http://localhost:50001/core/v1/users/2000",
"allowed" : [ "GET" ]
},
"avatar" : {
"ref" : "http://localhost:50001/core/v1/avatars/default",
"allowed" : [ "GET" ]
}
},
"id" : 2000
},
"replyCount" : 1,
"likeCount" : 0,
"resources" : {
"follower" : {
"ref" : "http://localhost:50001/core/v1/posts/1001/followers",
"allowed" : [ "POST" ]
},
"container" : {
"ref" : "http://localhost:50001/core/v1/blogs/1000",
"allowed" : [ "GET" ]
},
"likes" : {
"ref" : "http://localhost:50001/core/v1/posts/1001/likes",
"allowed" : [ "GET", "POST" ]
},
"images" : {
"ref" : "http://localhost:50001/core/v1/posts/1001/images",
"allowed" : [ "GET" ]
},
"self" : {
"ref" : "http://localhost:50001/core/v1/posts/1001",
"allowed" : [ "GET" ]
},
"html" : {
"ref" : "http://localhost:8080/blogs/o7lpZuZTHt/2011/08/02/8huzwhnywalbqlovvhdfyqigmh1fs3wkfso",
"allowed" : [ "GET" ]
},
"comments" : {
"ref" : "http://localhost:50001/core/v1/posts/1001/comments",
"allowed" : [ "GET", "POST" ]
}
},
"id" : 1001,
"creationDate" : "2011-08-02T23:26:14.272+0000",
"modificationDate" : "2011-08-02T23:26:14.272+0000",
"viewCount" : 0
}
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/posts/{id}/comments?offset=int&limit=int&excludeReplies=boolean&sort=String&anchor=String
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the content object | |
Query Parameters
Name | Type | Description | Default Value |
---|
offset | int | the 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" |
limit | int | the 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" |
excludeReplies | boolean | whether to only include top-level comments or not | "false" |
sort | String | the order in which the comments should be returned. Possible values are threaded and chronological. Defaults to chronological. | "chronological" |
anchor | String | optional 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. | |
Example
JSON Response Payload (No Pagination)
TBD
JSON Response (Pagination)
TBD
Get follower
Check if the user is following the specified comment content object
GET http://domain:port/application_context/api/core/v2/posts/{id}/followers/{userId}
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the identifier of the comment content object to check for followers. | |
userId | long | the id of the follower to check for | |
Response
Type | Description |
---|
UserSummary | the 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 given blog post
GET http://domain:port/application_context/api/core/v2/posts/{id}/images
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the blog post | |
Response
Type | Description |
---|
List of ImageEntity | a collection of images attached to the blog post |
Example
JSON Response Payload
[ {
"size" : 14945,
"ref" : "http://localhost:50001/oc/v1/images/1002",
"contentType" : "image/png"
}, {
"size" : 602438,
"ref" : "http://localhost:50001/oc/v1/images/1003",
"contentType" : "image/png"
} ]
Get like
Indicates whether the user likes the specified content object.
GET http://domain:port/application_context/api/core/v2/posts/{id}/likes/{userID}
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the content object | |
userID | long | the system wide unique identifier for the user | |
Response
Type | Description |
---|
UserSummary | the 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/posts/{id}/likes
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the content object | |
Response
Type | Description |
---|
EntityCollection | a 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/posts/{id}/tracks/{userId}
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | | |
userId | long | | |
Like
Adds a like to the specified content object
POST http://domain:port/application_context/api/core/v2/posts/{id}/likes
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the content object | |
Response
Type | Description |
---|
Response | a 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/posts/{id}/read
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | | |
Share
POST http://domain:port/application_context/api/core/v2/posts/{id}/share
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | | |
Track
POST http://domain:port/application_context/api/core/v2/posts/{id}/tracks
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | | |
Unfollow
Stop following the specified comment content object
DELETE http://domain:port/application_context/api/core/v2/posts/{id}/followers/{userId}
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the identifier of the comment content object. | |
userId | long | the id of the following user to be removed. | |
Unread
DELETE http://domain:port/application_context/api/core/v2/posts/{id}/read
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | | |
Update blog post
Updates the given blog post. The only fields that can be updated and recognized by the server are:
- subject: the subject of the blog post. Subjects must contain at least one character but less than 255
characters. Additionally, the string when turned into a URL (any non-safe url characters are turned to dashes),
must be unique on any given day. A subject of "blog" is not permitted.
- content: the body of the content. This must be specified in order for the request to complete successfully.
There is no limit to the length of the content and it can either be specified as plain text or as HTML.
- published: the published date and time of the post can be modified. If the date and time specified is after
the current date and time then the status of the post will change to be scheduled, as opposed to published, and
will not appear to other users.
PUT http://domain:port/application_context/api/core/v2/posts/{id}?minorEdit=boolean
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the blog post | |
Query Parameters
Name | Type | Description | Default Value |
---|
minorEdit | boolean | | "false" |
Response
Type | Description |
---|
Post | the JSON representation of the blog post |
Example
JSON Request Payload:
{
"content": {
"text" : "64gxPQYR3HidYTdks9fxD0y2SZph9d1ICSVqkQjhPBtS42fKsi",
"type" : "text/plain"
},
"published" : "2010-09-28T23:15:54.918+0000",
"subject" : "aigAajs15WSRs9QYSKZv"
}
JSON Response Payload
{
"published" : "2010-09-28T23:15:54.918+0000",
"content" : {
"type" : "text/html",
"text" : "<body><!-- [DocumentBodyStart:40b98d00-c411-4007-9a6d-e80207c5aa4d] --><div class=\"jive-rendered-content\"><span>64gxPQYR3HidYTdks9fxD0y2SZph9d1ICSVqkQjhPBtS42fKsi</span></div><!-- [DocumentBodyEnd:40b98d00-c411-4007-9a6d-e80207c5aa4d] --></body>"
},
"status" : "published",
"subject" : "aigAajs15WSRs9QYSKZv",
"author" : {
"name" : "user-0dI67J72swy4851s",
"username" : "user-0di67j72swy4851s",
"links" : {
"alt" : "http://localhost:50001/oc/v1/users/2008",
"avatar" : "http://localhost:50001/oc/v1/avatars/default"
}
},
"replyCount" : 0,
"likeCount" : 0,
"creationDate" : "2010-09-28T23:15:54.918+0000",
"modificationDate" : "2010-09-28T23:15:54.918+0000",
"viewCount" : 1,
"links" : {
"container" : "http://localhost:50001/oc/v1/blogs/1004",
"like" : "http://localhost:50001/oc/v1/posts/1005/likes",
"comments" : "http://localhost:50001/oc/v1/posts/1005/comments",
"follow" : "http://localhost:50001/oc/v1/posts/1005/followers"
}
}