Live Blog RESTful API¶
A short introduction to using the Live Blog RESTful API.
Live Blog API Tutorial¶
You can send GET requests for information to a Live Blog instance without needing to authenticate first. Responses are XML format by default, and are a combination of links to more information and text surrounded by markup.
In this example we request a complete list of Blogs hosted at the demo Live Blog server, decide which one we want from the title of the Blog, and then request all of the posts from that Blog.
Get the list of Blogs from server:
GET http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog
<?xml version="1.0" encoding="UTF-8"?> <BlogList total="5" limit="5" offset="0"> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/1"/> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/2"/> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/3"/> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4"/> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/5"/> </BlogList>
For each of these five Blogs, follow the link for information about the blog:
GET http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/1 GET http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/2 GET http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/3 GET http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4 GET http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/5
Excerpt response from Blog 5:
<?xml version="1.0" encoding="UTF-8"?> <Blog> <Id>5</Id> <IsLive>False</IsLive> <Description>The testing description</Description> <Title>The testing test</Title> <CreatedOn>10/4/13 12:58 PM</CreatedOn>
Excerpt response from Blog 4:
<?xml version="1.0" encoding="UTF-8"?> <Blog> <Id>4</Id> <IsLive>False</IsLive> <Description><span class="placeholder">and some description<span style="display: none;" sel-id="sel-1373981816301-18497082770598405"></span></span></Description> <Title>Test live blog to reproduce duplication of republished wrap-up posts</Title> <CreatedOn>7/15/13 4:58 PM</CreatedOn>
...
Decide that we want to get posts from “Test live blog to reproduce duplication of republished wrap-up posts”, which we know is Blog 4:
GET http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Post/Published
<?xml version="1.0" encoding="UTF-8"?> <PostList offsetMore="2" total="2" limit="2" lastCId="191" offset="0"> <Post href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Post/73"/> <Post href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Post/72"/> </PostList>
Note that we are only requesting Published posts here, to get Draft posts also ommit
/Published
from the URL.Follow each link for details of each post:
GET http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Post/72
<?xml version="1.0" encoding="UTF-8"?> <Post> <Id>72</Id> <IsModified>False</IsModified> <IsPublished>True</IsPublished> <CId>186</CId> <Order>30.0</Order> <AuthorName>Janet Editor</AuthorName> <Content>test</Content> <Meta>{}</Meta> <CreatedOn>7/16/13 12:50 PM</CreatedOn> <PublishedOn>7/16/13 12:50 PM</PublishedOn> <Author href="http://doc.sd-demo.sourcefabric.org/resources/Data/Collaborator/10"> <Id>10</Id> </Author> <AuthorPerson href="http://doc.sd-demo.sourcefabric.org/resources/HR/Person/2"> <Id>2</Id> </AuthorPerson> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4"> <Id>4</Id> </Blog> <Creator href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/2"> <Id>2</Id> </Creator> <Type href="http://doc.sd-demo.sourcefabric.org/resources/Data/PostType/wrapup"> <Key>wrapup</Key> </Type> </Post>
Complete the information about the Author, Type of Blog post, etc by following the links in the response.
See Resources for more information.
Authentication¶
Make a POST request to Security/Authentication with the following parameters:
- userName:
<USERNAME>
Example response:
<?xml version="1.0" encoding="UTF-8"?> <Authentication> <Token>93d9f8d01cf5e08e2b238c353582aac0394530a310d17fc4459974aa44267c09c4b6bac1fd02c1aeb41ac94b3a024ae8a03cc72b6045c1d3d00dbeb0b2f51a70</Token> </Authentication>
Calculate an SHA-512 encrypted string using a combination of the token received in the previous step, the user name and the password. This example uses the jsSHA library:
shaPassword = new jsSHA(password, "ASCII"); shaStep1 = new jsSHA(shaPassword.getHash("SHA-512", "HEX"), "ASCII"); shaStep2 = new jsSHA(loginToken, "ASCII"); HashedToken = shaStep1.getHMAC(username, "ASCII", "SHA-512", "HEX"); HashedToken = shaStep2.getHMAC(HashedToken, "ASCII", "SHA-512", "HEX");
For example code in Python see Authentication using Python.
Make a POST request to Security/Authentication/Login with the following parameters:
- Token:
<TOKEN>
- HashedToken:
<HASHED-TOKEN>
Use the session token from the response as a header for POST requests or as a parameter for GET requests that need authorization.
- param:
Authorization: <SESSION>
Resources¶
-
GET
/resources
¶ See a complete list of resources available on the server.
Example Request:
GET /resources HTTP/1.1 Host: http://doc.sd-demo.sourcefabric.org
Example Response:
<?xml version="1.0" encoding="UTF-8"?> <Resources> <AdminComponent href="http://doc.sd-demo.sourcefabric.org/resources/Admin/Component/"/> <AdminFile href="http://doc.sd-demo.sourcefabric.org/resources/Admin/File/"/> <AdminInput href="http://doc.sd-demo.sourcefabric.org/resources/Admin/Input/"/> <AdminMessage href="http://doc.sd-demo.sourcefabric.org/resources/Admin/Message/"/> <AdminPlugin href="http://doc.sd-demo.sourcefabric.org/resources/Admin/Plugin/"/> <AdminRequest href="http://doc.sd-demo.sourcefabric.org/resources/Admin/Request/"/> <AdminSource href="http://doc.sd-demo.sourcefabric.org/resources/Admin/Source/"/> <ArchiveAudioData href="http://doc.sd-demo.sourcefabric.org/resources/Archive/AudioData/"/> <ArchiveAudioInfo href="http://doc.sd-demo.sourcefabric.org/resources/Archive/AudioInfo/"/> <ArchiveImageData href="http://doc.sd-demo.sourcefabric.org/resources/Archive/ImageData/"/> <ArchiveImageInfo href="http://doc.sd-demo.sourcefabric.org/resources/Archive/ImageInfo/"/> <ArchiveMetaData href="http://doc.sd-demo.sourcefabric.org/resources/Archive/MetaData/"/> <ArchiveMetaDataInfoQuery href="http://doc.sd-demo.sourcefabric.org/resources/Archive/MetaDataInfo/Query"/> <ArchiveMetaInfo href="http://doc.sd-demo.sourcefabric.org/resources/Archive/MetaInfo/"/> <ArchiveMetaType href="http://doc.sd-demo.sourcefabric.org/resources/Archive/MetaType/"/> <ArchiveQueryCriteria href="http://doc.sd-demo.sourcefabric.org/resources/Archive/QueryCriteria/"/> <ArchiveVideoData href="http://doc.sd-demo.sourcefabric.org/resources/Archive/VideoData/"/> <ArchiveVideoInfo href="http://doc.sd-demo.sourcefabric.org/resources/Archive/VideoInfo/"/> <DataCollaborator href="http://doc.sd-demo.sourcefabric.org/resources/Data/Collaborator/"/> <DataPost href="http://doc.sd-demo.sourcefabric.org/resources/Data/Post/"/> <DataPostPublished href="http://doc.sd-demo.sourcefabric.org/resources/Data/Post/Published"/> <DataPostType href="http://doc.sd-demo.sourcefabric.org/resources/Data/PostType/"/> <DataPostUnpublished href="http://doc.sd-demo.sourcefabric.org/resources/Data/Post/Unpublished"/> <DataSource href="http://doc.sd-demo.sourcefabric.org/resources/Data/Source/"/> <DataSourceType href="http://doc.sd-demo.sourcefabric.org/resources/Data/SourceType/"/> <GUIAction href="http://doc.sd-demo.sourcefabric.org/resources/GUI/Action/"/> <Gateway href="http://doc.sd-demo.sourcefabric.org/resources/Gateway/"/> <GatewayCaptcha href="http://doc.sd-demo.sourcefabric.org/resources/Gateway/Captcha"/> <HRPerson href="http://doc.sd-demo.sourcefabric.org/resources/HR/Person/"/> <HRUser href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/"/> <HRUserType href="http://doc.sd-demo.sourcefabric.org/resources/HR/UserType/"/> <LiveDeskBlog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/"/> <LiveDeskBlogCollaboratorType href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/BlogCollaboratorType/"/> <LiveDeskBlogLive href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/Live"/> <LiveDeskBlogMediaType href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/BlogMediaType/"/> <LiveDeskBlogTheme href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/BlogTheme/"/> <LiveDeskBlogType href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/BlogType/"/> <LiveDeskSync href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Sync/"/> <LocalizationLanguage href="http://doc.sd-demo.sourcefabric.org/resources/Localization/Language/"/> <LocalizationLanguageAvailable href="http://doc.sd-demo.sourcefabric.org/resources/Localization/Language/Available"/> <RBACRole href="http://doc.sd-demo.sourcefabric.org/resources/RBAC/Role/"/> <SecurityRight href="http://doc.sd-demo.sourcefabric.org/resources/Security/Right/"/> <SecurityRightType href="http://doc.sd-demo.sourcefabric.org/resources/Security/RightType/"/> <ToolURLInfo href="http://doc.sd-demo.sourcefabric.org/resources/Tool/URLInfo/"/> </Resources>
Blogs¶
Resources related to Blogs.
-
GET
/resources/LiveDesk/Blog
¶ Lists available blogs.
Example Request:
GET /resources/LiveDesk/Blog HTTP/1.1 Host: http://doc.sd-demo.sourcefabric.org
Example Response:
<?xml version="1.0" encoding="UTF-8"?> <BlogList total="5" limit="5" offset="0"> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/1"/> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/2"/> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/3"/> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4"/> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/5"/> </BlogList>
Get a complete list of parameters by adding
¶ms=show
to your request.
-
GET
/resources/HR/User/
(int: id)/Blog
¶ Lists blogs assigned to user id.
Example Request:
GET /resources/HR/User/5/Blog HTTP/1.1 Host: http://doc.sd-demo.sourcefabric.org
Example Response:
<?xml version="1.0" encoding="UTF-8"?> <BlogList total="1" limit="1" offset="0"> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/2"/> </BlogList>
Get a complete list of parameters by adding
¶ms=show
to your request.
-
GET
/resources/HR/User/
(int: id)/Blog/Live
¶ Lists live blogs assigned to user id.
Example Request:
GET /resources/HR/User/5/Blog/Live HTTP/1.1 Host: http://doc.sd-demo.sourcefabric.org
Example Response:
<?xml version="1.0" encoding="UTF-8"?> <BlogList> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/2"/> </BlogList>
Get a complete list of parameters by adding
¶ms=show
to your request.
-
GET
/resources/LiveDesk/Blog/
(int: id)¶ Shows information about Blog id.
Example Request:
GET /resources/LiveDesk/Blog/4 HTTP/1.1 Host: http://doc.sd-demo.sourcefabric.org
Example Response:
<?xml version="1.0" encoding="UTF-8"?> <Blog> <Id>4</Id> <IsLive>False</IsLive> <Description><span class="placeholder">and some description<span style="display: none;" sel-id="sel-1373981816301-18497082770598405"></span></span></Description> <Title>Test live blog to reproduce duplication of republished wrap-up posts</Title> <CreatedOn>7/15/13 4:58 PM</CreatedOn> <UpdatedOn>6/18/13 2:53 PM</UpdatedOn> <Creator href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/2"> <Id>2</Id> </Creator> <Language href="http://doc.sd-demo.sourcefabric.org/resources/Localization/Language/3"> <Id>3</Id> </Language> <Type href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/BlogType/2"> <Id>2</Id> </Type> <Collaborator href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Collaborator/"/> <CollaboratorPotential href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Collaborator/Potential"/> <Sync href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Sync/"/> <Configuration href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Configuration/"/> <Post href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Post/"/> <PostComment href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Post/Comment"/> <PostPublished href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Post/Published"/> <PostUnpublished href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Post/Unpublished"/> <CommentPost href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Comment/Post/"/> <Source href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Source/"/> <BlogMedia href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/BlogMedia/"/> </Blog>
Get a complete list of parameters by adding
¶ms=show
to your request.
Posts¶
-
GET
/resources/LiveDesk/Blog/
(int: id)/Post/Published
¶ Shows all published posts on Blog id.
Example Request:
GET /resources/LiveDesk/Blog/4/Post/Published HTTP/1.1 Host: http://doc.sd-demo.sourcefabric.org
Example Response:
<?xml version="1.0" encoding="UTF-8"?> <PostList offsetMore="2" total="2" limit="2" lastCId="191" offset="0"> <Post href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Post/73"/> <Post href="http://doc.sd-demo.sourcefabric.org/resources/LiveDesk/Blog/4/Post/72"/> </PostList>
Get a complete list of parameters by adding
¶ms=show
to your request.
-
POST
/resources/LiveDesk/Blog/
(int: id)/Post
¶ Insert a post into Blog id, but do not publish it.
Example Request:
POST /resources/LiveDesk/Blog/4/Post/ HTTP/1.1 Host: http://doc.sd-demo.sourcefabric.org
Request Headers: - Authorization – Session authorization token, see Authentication
-
POST
/resources/LiveDesk/Blog/
(int: id)/Post/Publish
¶ Insert a post into Blog id and publish it immediately.
Example Request:
POST /resources/LiveDesk/Blog/4/Post/ HTTP/1.1 Host: http://doc.sd-demo.sourcefabric.org
Request Headers: - Authorization – Session authorization token, see Authentication
Users¶
-
GET
/resources/HR/User/
(int: id)¶ Show information about user id.
Example Request:
GET /resources/HR/User/5 HTTP/1.1 Host: http://doc.sd-demo.sourcefabric.org
Example Response:
<?xml version="1.0" encoding="UTF-8"?> <User> <Id>5</Id> <Active>True</Active> <EMail>Sarah.Stringer@email.addr</EMail> <FirstName>Sarah</FirstName> <FullName>Sarah Stringer</FullName> <LastName>Stringer</LastName> <Name>stringer</Name> <CreatedOn>7/2/13 11:43 AM</CreatedOn> <Type href="http://doc.sd-demo.sourcefabric.org/resources/HR/UserType/standard"> <Key>standard</Key> </Type> <Role href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/5/Role/"/> <Right href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/5/Right/"/> <Blog href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/5/Blog/"/> <BlogLive href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/5/Blog/Live"/> <Action href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/5/Action/"/> <Post href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/5/Post/"/> <PostPublished href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/5/Post/Published"/> <PostUnpublished href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/5/Post/Unpublished"/> <Collaborator href="http://doc.sd-demo.sourcefabric.org/resources/HR/User/5/Collaborator/"/> <MetaDataIcon href="http://doc.sd-demo.sourcefabric.org/resources/HR/Person/5/MetaData/Icon"/> </User>
Get a complete list of parameters by adding
¶ms=show
to your request.