Response Formats

Each call to Osmek will return data in one of the following formats, based upon what you specify via the format parameter in your request. If format is not specified JSON will be returned. Example: &format=custom.

JSON

After posting the following variables to http://api.osmek.com/feeds:

  • api_key=[removed]
  • section_id=932
  • format=json
  • limit=1

The response from Osmek will be something like:

{
	"total":1,
	"items": [
		{
			"id":"9952",
			"sect_id":"932",
			"c_sort":"0",
			"date_added":"2009-12-22 21:15:19",
			"date":"2009-12-22 21:15:19",
			"flag":null,
			"title":"Lorem Ipsum Dolor",
			"url_title":"Lorem-Ipsum-Dolor",
			"postbody":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque felis tellus, tincidunt id vulputate ac, iaculis sed velit.",
			"photo":null,
			"file":null,
			"active":"1",
			"author":"1",
			"allow_comments":"1",
			"date_stamp":"1261538119",
			"comment_count":"0"
		}
	]
}

For feeds requested as JSON, all available data will be included in the response. If you include the parameter vars in your call you can specity what variables you want, and how their values should be formatted. The vars parameter should be a list of variable keywords as a pipe ("|") delimited string.

Adding a vars parameter will limit the data in the results. Posting the following variables yields the following response:

  • api_key=[removed]
  • section_id=932
  • format=json
  • limit=1
  • vars=date *F *j*S, *Y|title
{"total":1,"items":[{"date":"May 25th, 1982","title":"Matt's Birthday!"}]}

XML

Osmek will return your feeds in preformatted XML.

RSS

Osmek can generate RSS for any content bin type.

HTML

Osmek will return your feeds in preformatted HTML.

Custom

The custom option allows you to specify a template using the parameter template. Learn more about templates in the Template Parsing section.

Example:

After posting the following variables to http://api.osmek.com/feeds:

  • api_key=[removed]
  • section_id=932
  • format=custom
  • limit=1
  • template=<h2>[title]</h2><span class="date">[date *F *j*S, *Y]</span>

The response will be something like:

<h2>Matt's Birthday!</h2><span class="date">May 25th, 1982</span>