The Editorial Web Service
The Live Center editorial web service is very similar to the Content Engine web service, with the main difference being that instead of returning content in the form of XML Atom feeds, it returns JSON data. If you are familiar with the Content Engine web service, then you will find the Live Center web service easy to use. If you haven't used the Content Engine web service before, then you should probably start by reading at least the introduction of the Escenic Content Engine Integration Guide.
The editorial web service provides a standard REST HTTP API in
which all operations are performed by sending GET
,
POST
, PUT
or
DELETE
requests to various URLs. The default name of
the web service is live-center-editorial
.
Unlike the Content Engine web service, the Live Center editorial web service
has no global entry point or "start" URL. Before you do anything with
the web service, therefore, you usually need to obtain the ID of an
Event content item (either from the Content Engine
presentation layer or the Content Engine web
service). Once you have an Event id you can request information about it
by submitting a GET
request like this to the web
service:
http://host-ip-address/live-center-editorial/event/event-id
where host-ip-address is your
Live Center host name
or IP address and event-id is the ID of the
event you are interested in. Authentication is required, so if you
submitted the request using curl
, then the whole
command for an event with the id 24
would look like
this:
curl -u user:password -X GET http://host-ip-address/live-center-editorial/event/24
Live Center then returns a JSON structure that looks something like this:
{ "id": 24, "title": "Liverpool - Manchester United", "entries": "http://host-ip-address/live-center-editorial/event/24/entries", "self": "http://host-ip-address/live-center-editorial/event/24", "changelog": "http://host-ip-address/live-center-editorial/changelog/event/24", "entryModel": "http://host-ip-address/live-center-editorial/model/24/football", "payload": [ { "name": "title", "value": "Liverpool - Manchester United" }, { "name": "description", "value": "Match: 23. January 2015" } ], "subscriptions": [ { "link": "http://host-ip-address/live-center-editorial/event/24/subscription/0", "source": "twitter" }, { "link": "http://host-ip-address/live-center-editorial/event/24/subscription/1", "source": "twitter" } ] }
The actual content of this document, as in
all the JSON structures returned by the web service, is in the
payload
field. In this case
payload
contains the field values of the Event
content item - a title and a description. The rest of the document
mostly consists of links that you can follow to obtain further
information. Submitting a new GET
request to the
entries
URL, for example:
curl -u user:password -X GET http://host-ip-address/live-center-editorial/event/24/entries
This returns a JSON document containing all the event's entries plus related information:
{ "entries":[ { "author":{ "value": "A.N. Other", "origin": "http://host-ip-address/webservice/escenic/person/7" }, "creator":{ "value": "livedemo Administrator", "origin": "http://host-ip-address/webservice/escenic/person/1" }, "creationDate": "2015-02-13T12:20:24.000+0000", "eTag": "0d1f1e1f-6bf2-46fd-8de4-c1de0c015f0a", "event": "http://host-ip-address/live-center-editorial/event/24", "lastModifiedDate": "2015-02-13T12:36:38.000+0000", "model": "http://host-ip-address/live-center-editorial/model/24/football", "parent": "http://host-ip-address/live-center-editorial/entry/251", "payload":[ { "name": "basic", "value": "Test entry" } ], "publishDate": "2015-02-13T12:20:24.000+0000", "self": "http://host-ip-address/live-center-editorial/entry/283", "state": "published", "tags":[] }, ...(more entries)... ] }
Like many REST APIs, the Live Center API is more or less self-documenting. It consists entirely of URLs, and the fields in the returned JSON documents have reasonably self-explanatory names. A good way of learning the API is to install a REST API browser extension such as DHC for Chrome, and simply explore it.
Usage of the HTTP commands follows standard rest conventions:
-
Send
GET
to a URL to retrieve a resource (as in the examples above) -
Send
PUT
to a URL to modify a resource -
Send
POST
to a URL to create a new resource -
Send
DELETE
to a URL to delete a resource