Platform API‎ > ‎Contentbox‎ > ‎

Content Item

URI Pattern

Each item in the store has its own URI based on its unique identifier:

http://api.talis.com/stores/{storename}/items/{id}

Resource Operations

URI PatternMethodRequest BodySemanticsCapability required
/items/{id}GETRetrieve an Itembasic search
HEADStandard HTTP Head semanticsbasic search
PUTContent to storeReplace an item, or add a new itemfull update
DELETEDelete an itemfull update

Request Parameters

None.

Managing Content Items

The full set of Create, Read, Update and Delete operations are supported for content items.

Retrieve an Item

GETs to a content item require the basic search capability.

The response to a GET request will include an etag HTTP header which may be used to perform conditional GETs, PUTs and DELETEs

Note: If a GET is issued to an item that does not exist in the contentbox the Platform checks to see if it has any metadata about the requested item in the store's Metabox. If so the response will be an RDF/XML document containing any triples found in the contentbox that have the requested item as a subject, if so it returns a 303 response redirecting the request to the RDF description.

Replace an Item

Replacing a content item require the full update capability.

PUT can be used to replace an item or create a new one. Any triples about the item in the metabox will be removed and replaced by any extracted from the new item.

The client can use the if-match and if-none-match HTTP headers to perform a conditional update. This can prevent the "lost update" problem where a client gets an item and updates it inadvertently overwriting another client's changes that were made between the GET and the PUT. The effects of using these headers is shown in the following table:

HeaderValueAction
if-matchan etagThe PUT will succeed only if an item with the supplied etag is stored at the URI
if-match*The PUT will succeed only if any item is stored at the URI
if-none-matchan etagThe PUT will succeed only if an item with a different etag to that supplied is stored at the URI
if-none-match*The PUT will succeed only if no item is stored at the URI


Add A New Item

Adding an item requires the full update capability.

Items can be added to the Contentbox in two ways. These differ in how identifiers are assigned to the new content item:

  1. Platform assigned identifier -- POST content directly to the Contentbox
  2. Client assigned identifier -- PUT content to any valid Content Item URI.

For information on the first option, refer to the Contentbox docs for further information. The rest of this section refers to client assignment of content item identifiers.

A user with full update capability is able to issue a PUT on any URI that is prefixed with a store's content box URI, i.e. that matches the content item uri pattern.

The body of the PUT request will be added to the content box and processed in the usual way. The URI put to must not contain a query string and must be a valid URI according to the HTTP URI specification.

As examples, the following URIs are valid:

  http://api.talis.com/stores/{storename}/items/1
  http://api.talis.com/stores/{storename}/items/foo
  http://api.talis.com/stores/{storename}/items/-----blah-----
  http://api.talis.com/stores/{storename}/items/index.html
  http://api.talis.com/stores/{storename}/items/1/2/3/4/5

However, the following are not allowed:

  http://api.talis.com/stores/{storename}/foo 
  http://api.talis.com/stores/{storename}/items?foo=1

Delete An Item

Deleting a content item requires the full update capability.

An HTTP DELETE request can be used to remove an item from the Contentbox. Any triples about it in the Metabox will also be removed.

The client can use the if-match and if-none-match HTTP headers to perform a conditional delete. This can prevent the "lost update" problem where a client gets an item and updates it inadvertently overwriting another client's changes that were made between the GET and the DELETE. The effects of using these headers is shown in the following table:

HeaderValueAction
if-matchan etagThe DELETE will succeed only if an item with the supplied etag is stored at the URI
if-match*The DELETE will succeed only if any item is stored at the URI
if-none-matchan etagThe DELETE will succeed only if an item with a different etag to that supplied is stored at the URI
if-none-match*The DELETE will succeed only if no item is stored at the URI
Comments