Blog Service
OpenClient endpoint for retrieving and managing blogs
Resource | Description |
---|
Create blog post | Creates a blog post in the specified blog |
Follow | Start following the specified container. |
Get blog | Returns the specified blog. |
Get blog posts | Returns the latest blog posts sorted by the date they were published. |
Get blogs | Returns a collection of blogs. |
Get follower | Check if the user is following the specified container |
Unfollow | Stop following the specified container |
Create blog post
Creates a blog post in the specified blog
POST http://domain:port/application_context/api/core/v2/blogs/{id}/posts
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the blog | |
Form Parameters
Name | Type | Description | Default Value |
---|
subject | String | the subject of the blog post. A subject must be provided or an error will occur. | |
html | DocumentParam | the HTML body of the blog post | |
attachmentURIs | Set | any URIs for the attachments which are to be attached to the blog post | |
publish | String | an optional paramater which will configure the date that the blog post should be published | |
Response
Type | Description |
---|
Response | a HTTP 201 response including the URL for the created blog post in the Location header |
Follow
Start following the specified container.
POST http://domain:port/application_context/api/core/v2/blogs/{id}/followers
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the identifier of the container to follow. | |
Response
Type | Description |
---|
Response | a HTTP 201 response including the URL for the subscription in the Location header |
Get blog
Returns the specified blog.
GET http://domain:port/application_context/api/core/v2/blogs/{id}
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the blog. | |
Response
Type | Description |
---|
blog | the JSON representation of the blog. |
Example
JSON Response Payload
{
"name" : "LFp0eqAfDC",
"displayName" : "p9JbhHr3vK",
"contents" : [ {
"name" : "posts",
"ref" : "http://localhost:50001/oc/v1/blogs/1000/posts"
} ],
"id" : 1000,
"type" : 37,
"creationDate" : "2010-08-12T21:51:52.828+0000",
"modificationDate" : "2010-08-12T21:51:52.828+0000"
}
Get blog posts
Returns the latest blog posts sorted by the date they were published.
GET http://domain:port/application_context/api/core/v2/blogs/{id}/posts?limit=int&after=String&before=String&q=String&offset=int
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the system wide unique identifier for the blog | |
Query Parameters
Name | Type | Description | Default Value |
---|
limit | int | the maximum number of blog posts to return. If there are fewer blog posts available
in the given time period, if either after or before is provided, then fewer blog posts will be returned then the
limit. | "25" |
after | String | blog posts newer than the date provided. That is, if the limit is 5 then the first 5 blog posts
published after the provided date will be returned. The provided date is required to be formatted in
ISO 8601 format. | |
before | String | blog posts older than the date provided. That is, given a limit of 5 then the first 5 blog posts
published before the provided date will be returned. The provided date is required to be formatted in
ISO 8601 format. | |
q | String | when provided, will search the posts in the container using the given query. | |
offset | int | used in conjuction with query when paginating through posts related to a search. | "0" |
Response
Type | Description |
---|
EntityCollection | a collection of replies to the blog post ordered by the date they were published. |
Example
JSON Response Payload
{
"data" : [ {
"comments" : 0,
"published" : "2010-08-12T21:51:55.724+0000",
"content" : {
"type" : "text/plain",
"body" : "fnus1fxn5z"
},
"status" : "published",
"subject" : "MC2DM6Uscy",
"author" : {
"name" : "user-l9F5Dn5rJH3hsR2T",
"username" : "user-l9f5dn5rjh3hsr2t",
"id" : 2008,
"type" : 3,
"links" : {
"alt" : "http://localhost:50001/oc/v1/users/2008",
"avatar" : "http://localhost:50001/oc/v1/avatars/default"
}
},
"likes" : 0,
"id" : 1007,
"type" : 38,
"creationDate" : "2010-08-12T21:51:55.724+0000",
"modificationDate" : "2010-08-12T21:51:55.729+0000",
"links" : {
"alt" : "http://localhost:50001/oc/v1/posts/1007",
"comments" : "http://localhost:50001/oc/v1/posts/1007/comments"
}
}, {
"comments" : 0,
"published" : "2010-08-12T21:51:55.707+0000",
"content" : {
"type" : "text/plain",
"body" : "RC7eIx2Muf"
},
"status" : "published",
"subject" : "6eEofrWgDp",
"author" : {
"name" : "user-oSXIL7OhDXJ7fS1k",
"username" : "user-osxil7ohdxj7fs1k",
"id" : 2007,
"type" : 3,
"links" : {
"alt" : "http://localhost:50001/oc/v1/users/2007",
"avatar" : "http://localhost:50001/oc/v1/avatars/default"
}
},
"likes" : 0,
"id" : 1006,
"type" : 38,
"creationDate" : "2010-08-12T21:51:55.707+0000",
"modificationDate" : "2010-08-12T21:51:55.714+0000",
"links" : {
"alt" : "http://localhost:50001/oc/v1/posts/1006",
"comments" : "http://localhost:50001/oc/v1/posts/1006/comments"
}
}, {
"comments" : 0,
"published" : "2010-08-12T21:51:55.691+0000",
"content" : {
"type" : "text/plain",
"body" : "8kL2bzNh8g"
},
"status" : "published",
"subject" : "YQlxo05WyM",
"author" : {
"name" : "user-MGXL4kFi0hv7jQcb",
"username" : "user-mgxl4kfi0hv7jqcb",
"id" : 2006,
"type" : 3,
"links" : {
"alt" : "http://localhost:50001/oc/v1/users/2006",
"avatar" : "http://localhost:50001/oc/v1/avatars/default"
}
},
"likes" : 0,
"id" : 1005,
"type" : 38,
"creationDate" : "2010-08-12T21:51:55.691+0000",
"modificationDate" : "2010-08-12T21:51:55.697+0000",
"links" : {
"alt" : "http://localhost:50001/oc/v1/posts/1005",
"comments" : "http://localhost:50001/oc/v1/posts/1005/comments"
}
}, {
"comments" : 0,
"published" : "2010-08-12T21:51:55.676+0000",
"content" : {
"type" : "text/plain",
"body" : "URg4c20oN7"
},
"status" : "published",
"subject" : "IlOijzOuBn",
"author" : {
"name" : "user-wg3jecmv5JlAx4UU",
"username" : "user-wg3jecmv5jlax4uu",
"id" : 2005,
"type" : 3,
"links" : {
"alt" : "http://localhost:50001/oc/v1/users/2005",
"avatar" : "http://localhost:50001/oc/v1/avatars/default"
}
},
"likes" : 0,
"id" : 1004,
"type" : 38,
"creationDate" : "2010-08-12T21:51:55.676+0000",
"modificationDate" : "2010-08-12T21:51:55.682+0000",
"links" : {
"alt" : "http://localhost:50001/oc/v1/posts/1004",
"comments" : "http://localhost:50001/oc/v1/posts/1004/comments"
}
}, {
"comments" : 0,
"published" : "2010-08-12T21:51:55.356+0000",
"content" : {
"type" : "text/plain",
"body" : "zl0WiAEjVC"
},
"status" : "published",
"subject" : "CTKt1YUfJr",
"author" : {
"name" : "user-S1ApRz14YRcWVi1G",
"username" : "user-s1aprz14yrcwvi1g",
"id" : 2004,
"type" : 3,
"links" : {
"alt" : "http://localhost:50001/oc/v1/users/2004",
"avatar" : "http://localhost:50001/oc/v1/avatars/default"
}
},
"likes" : 0,
"id" : 1003,
"type" : 38,
"creationDate" : "2010-08-12T21:51:55.356+0000",
"modificationDate" : "2010-08-12T21:51:55.368+0000",
"links" : {
"alt" : "http://localhost:50001/oc/v1/posts/1003",
"comments" : "http://localhost:50001/oc/v1/posts/1003/comments"
}
} ],
"links" : {
"next" : "http://localhost:50001/oc/v1/blogs/1002/posts?limit=5&before=2010-08-12T21%253A51%253A55.356%252B0000",
"previous" : "http://localhost:50001/oc/v1/blogs/1002/posts?limit=5&after=2010-08-12T21%253A51%253A55.724%252B0000"
}
}
Get blogs
Returns a collection of blogs. The blogs are sorted by their creation date from newest to oldest and
can be iterated through utilizing the date parameters since and until.
GET http://domain:port/application_context/api/core/v2/blogs?limit=int&after=String&before=String
Query Parameters
Name | Type | Description | Default Value |
---|
limit | int | the maximum number of blog posts to return. If there are fewer blog posts available
in the given time period, if either after or before is provided, then fewer blog posts will be returned then the
limit. | "25" |
after | String | blogs newer than the date provided. That is, if the limit is 5 then the first 5 blogs
create after the provided date will be returned. The provided date is required to be formatted in
ISO 8601 format. | |
before | String | blog posts older than the date provided. That is, given a limit of 5 then the first 5 blogs
created before the provided date will be returned. The provided date is required to be formatted in
ISO 8601 format. | |
Example
JSON Response Payload
{
"data" : [ {
"name" : "aaFwGTi6Oq",
"displayName" : "7b20P67zMm",
"resources" : {
"posts" : {
"ref" : "http://localhost:50001/oc/v1/blogs/1001/posts",
"allowed" : [ "GET" ]
},
"self" : {
"ref" : "http://localhost:50001/oc/v1/blogs/1001",
"allowed" : [ "GET" ]
}
},
"creationDate" : "2010-11-17T22:40:15.697+0000",
"modificationDate" : "2010-11-17T22:40:15.697+0000",
"viewCount" : 0
}, {
"name" : "JClbDkxOhX",
"displayName" : "6iFpP1OhbK",
"resources" : {
"posts" : {
"ref" : "http://localhost:50001/oc/v1/blogs/1000/posts",
"allowed" : [ "GET" ]
},
"self" : {
"ref" : "http://localhost:50001/oc/v1/blogs/1000",
"allowed" : [ "GET" ]
}
},
"creationDate" : "2010-11-17T22:40:15.646+0000",
"modificationDate" : "2010-11-17T22:40:15.646+0000",
"viewCount" : 0
} ],
"links" : {
"next" : "http://localhost:50001/oc/v1/blogs/1002/posts?limit=5&before=2010-08-12T21%253A51%253A55.356%252B0000",
"previous" : "http://localhost:50001/oc/v1/blogs/1002/posts?limit=5&after=2010-08-12T21%253A51%253A55.724%252B0000"
}
}
Get follower
Check if the user is following the specified container
GET http://domain:port/application_context/api/core/v2/blogs/{id}/followers/{userId}
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the identifier of the container 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 |
Unfollow
Stop following the specified container
DELETE http://domain:port/application_context/api/core/v2/blogs/{id}/followers/{userId}
Path Parameters
Name | Type | Description | Default Value |
---|
id | long | the identifier of the container. | |
userId | long | the id of the following user to be removed. | |