homesupportdeveloper reference

this document covers feed structure. looking for feed parsers? we have sample libraries inphp,visual basic and c#, andjava.

overview

this reference aims to cover the structure and content of an article feed. working knowledge of xml and http is assumed.

all requests to the api are made using http gets. valid requests will be met with a http 200 response code while invalid requests will be met with http 4xx or 5xx codes.

this guide provides example urls that correspond to the distributed parts of the content feed. with the exception of the api root, it isstrongly recommendedto use provided href attributes to discover the urls of feed content.

key terms

feed
the set of xml documents that collectively provide brafton content in a structured manner. the “feed” is not a reference to any specific xml structure, but rather the system as a whole.
article
the eventual destination of the content as a coherent whole. as brafton feeds are intended to be consumed by a variety of different content management systems and blogging software, this is an abstract concept. precise definitions and implementation are left to the software in question.
api domain
a feed’s serving domain, usually api.brafton.com. provided by your account manager. within this document, this is referenced by {api domain}– you should replace this with your provided domain when querying the api.
api key
a guidthat uniquely identifies a feed, provided by your account manager. within this document, this is referenced by {api key}– you should replace this with your provided key when querying the api.

[jump to top]

api root

theapi rootis the starting point for feeds and their parsers, and provides core information such as the feed’s key, state, and url where a collection of recently published content can be found (news item collection).

the url for the api root ishttp://{api domain}/{api key}/

element value type description
api xml node the root node.
key guid the feed’s identifyingapi key.
name string the friendly name of the feed.
feedstate enumeration

the current status of the feed. this will be one of the following values:

  • live – this feed can receive new content.
  • trial – this feed is ready for testing purposes. feeds in trial house one or more example news items.
  • disabled – this feed does not receive new content.
news xml node provides the href attribute. the news element itself will have no inner text.
news [href] url specifies the url of the collection of the most recently published content.
categorydefinitions xml node provides the href attribute. the categorydefinitions element itself will have no inner text.
categorydefinitions [href] url specifies the url of categories for content to be filed under. the data at the url provided will be in the form of acategory collection.

example response

  01234567-89ab-cdef-0123-456789abcdef example company live   

[jump to top]

news item collection

thenews item collectionis the list of zero or more published news items within the last 30 days. if there has been no published items within 30 days, the collection will contain zero items.

the news item collection provides an overview of all news items currently in the feed. the full content for a news item can be retrieved at the url provided within the newslistitem href attribute.

element value type description
news xml node the root node for news item collections. provides the state attribute, a mirror of the api root’sfeedstatenode.
newslistitem xml node represents a news item in the collection. there may be zero or more newslistitem nodes within a news item collection. each provides an href attribute.
newslistitem [href] url specifies the unique url for the news item, where the full text and metadata can be found.
id integer internal, unique id for a news item. these numbers are defined by brafton and may not be sequential within a feed.
publishdate datetime the date and time of the news item’s approval by a client.
lastmodifieddate datetime the date and time of the news item’s last modification by a brafton writer or editor.
headline string the title of the news item.

example response

   123456 2009-12-04t13:00:00 2009-12-06t15:50:31 example article  

[jump to top]

news item

anews itemcontains the content and metadata for an article. libraries built against the feed should check for the existence of optional elements.

required elements

element value type description
newsitem xml node the root node for a news item. provides the encoding attribute.
newsitem [encoding] enumeration defines the encoding for the feed’s content. may be one of the following values:

  • utf-8 – the default feed encoding. indicates the full unicode character set may be used in content.
  • ascii – legacy option. indicates only the ascii character set may be used in content.
id integer internal, unique id for a news item. these numbers are defined by brafton and may not be sequential within a feed.
state string published state of the news item.deprecated. will always be “live”.
publishdate datetime the date and time of the news item’s approval by a client. mirrors the respectivepublishdate within a news item collection.
createddate datetime the date and time of the news item’s creation (when it was started by a brafton writer).
lastmodifieddate datetime the date and time of the news item’s last modification by a brafton writer or editor. mirrors the respectivelastmodifieddate within a news item collection.
headline string the title of the news item.
categories xml node provides the href attribute. this node itself will contain no inner text.
note: this node will be present even if the news item has no associated categories.
categories [href] url specifies the url to the list of categories this news item is associated with. the data at the url provided will be in the form of acategory collection
photos xml node provides the href attribute. this node itself will contain no inner text.
photos [href] url specifies the url to the list of photos this news item is associated with.
note: this node will be present even if the news item has no associated photos.
text string the main content of a news item. the inner text is html-formatted and may contain html tags and entities.

optional elements

element value type description
htmltitle string text intended to be used as or within the html title tag for the article.
htmlmetadescription string text intended to be used as or within the html meta description for the article.
extract string introductory text for the news item.
byline string the name of the author the article is to be attributed to.
source string citation sources for the article, such as a website url, newspaper, or other publication.
htmlmetakeywords string list of comma-separated keywords to be used in the html meta keywords tag.
tags string list of comma-separated tags relating to the article.

example response

  123456 live 2009-12-04t13:00:00 2009-12-02t09:41:05 2009-12-06t15:50:31 example article this text might appear as introductory text for your articles.   example article this text would go in the meta description of the page - this is what readers will see from search engines. 

the article body appears in the text tag.

content from this tag will adapt to defined styles on your blog or content management system when published.

[jump to top]

category collection

thecategory collectionprovides a list of categories. items in this collection will refer to a set of shared categories for the feed. the collection itself may be associated with at most one news item.

element value type description
xml node root node of a category collection containing zero or more child nodes. the name of this node differs depending on the current url:

  • categorydefinitions – if accessed via the api root’s categorydefinitions href
  • categories – if accessed via a news item’s categories href
category xml node defines a single category.
id integer internal, unique id for a category. these numbers are defined by brafton and may not be sequential within a feed.
name string the category’s human-readable name.

example response

   654321 example category  

[jump to top]

photo collection

aphoto collectionis a list of images associated with a news item. each item in a photo collection, aphoto, represents an image with a summary of its content. each photo will contain a set of child nodes that describe the photo’s physical attributes. this set is collectively called aphoto instance.

photos must be saved locally.provided urls are not for long-term serving and rendered inaccessible after 30 days.

element value type description
photos xml node root node of the collection. contains zero or more child nodes.
photo xml node represents a photo in the collection. contains child nodes for image metadata.
id integer internal, unique id for a photo. these numbers are defined by brafton and may not be sequential within a feed.
caption string text associated with the image, intended as a caption.note: this node is optional and may not be present in all feeds.
htmlalt string text associated with the photo, intended as the image’s alt text.note: this node is optional and may not be present in all feeds.
orientation enumeration defines the photo’s major, or longest, axis. may be one of the following values:

  • portrait – the major axis is the y axis (longer height).
  • landscape – the major axis is the x axis (longer width).
instances xml node parent node for photo instances. contains one or more child nodes.
instance xml node defines a photo instance. contains child nodes with additional image metadata.
width integer the width of the photo instance, in pixels.
height integer the height of the photo instance, in pixels.
type enumeration the relative size of the photo instance. may be one of the following values:

  • small – a relatively small-sized instance of the photo. useful for thumbnails and low-resolution mobile devices.
  • medium – a relatively medium-size instance of the photo. useful for display alongside the full text of an article.
  • large – a relatively large-size instance of the photo. useful for displaying on its own to highlight detail or text that would otherwise be difficult to read.
  • thumbnail – a thumbnail-sized instance of the photo. useful for previews.

    deprecated. superceded by small.

  • fullsize – the original size of the photo. useful for displaying detail or for display as a standalone image.

    deprecated. superceded by large.

url url the url where this photo instance is temporarily served.

note: photo instances invalidate after 30 days, and must be saved locally to ensure long-term storage. do not link to a photo instance within an article.

example response

   98765 a caption relating the article to the image. text to provide in an alt tag, for accessibility. landscape   500 334 large http://pictures.brafton.com/example-article-image.jpg    

[jump to top]

value types

type description literals
datetime a composition of a date component and a time component. a timestamp iniso 8601format.
guid agloballyuniqueidentifier in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. case insensitive. numbers 0-9 and letters a-f.
string a sequence of unicode characters. unless otherwise specified, strings are free text and not sanitized for html or url use. all unicode characters. escape sequences are not supported.
url a sequence of unicode characters that identifies an internet resource. valid urls, beginning with http:// or https://.
integer an unsigned 32-bit integer. all literals comprised of digits 0-9.
enumeration a string that is constrained to a set of values. please see the specific element’s description for a list of valid values. all unicode characters. escape sequences are not supported.

[jump to top]