Connector Feed Response - Draft Specification 1.0 version 1

Feed responses are returned from any of the entity paths, including requests for single resources and relationships.

Example:
http://connector.jangle.org/resources/

Methods allowed: GET, HEAD

Content-type required: application/json

JSON schema:

{
"description":"A feed of entity resources",
"type":"object",
"properties":{
  "type":{"type":"string","pattern":"/^feed|search$/"},
  "request":{"type":"string","format":"uri"},
  "time":{"type":""string","format":"date-time"},
  "offset":{"type":"integer"},
  "totalResults":{"type":"integer"},
  "extensions":{"type":"object","optional":true,"additionalProperties":{
    "type":"string","format":"uri"
    }
  },
  "formats":{"type":"array","items":{"type":"string","format":"uri"}},
  "alternate_formats":{"type":"object","optional":true,
    "additionalProperties":{
      "type":"string","format":"uri"
    }
  },
  "stylesheets":{"type":"array","optional":true,"items":{"type":"string","format":"uri"}},
  "categories":{"type":"array","optional":true,"items":{"type":"string"}},
  "data":{"type":"array","items":[
    "type":"object",
    "properties":{
      "id":{"type":"string","format":"uri"},
      "title":{"type":"string"},
      "updated":{"type":string","format":"date-time"},
      "created":{"type":string","format":"date-time","optional":true},
      "description":{"type":"string","optional":true},
      "content":{"type":"string","optional":true,"requires":["content_type","format"]},
      "content_type":{"type":"string","requires":["content","format"],"optional":true},
      "stylesheet":{"type":"string","optional":true,"format":"uri"},
      "format":{"type":"string","format":"uri","requires":["content","content_type"]},
      "alternate_formats:{"type":"object","optional":true,
        "additionalProperties":{
          "type":"string","format":"uri"
        }
      },
      "relationships":{"type":"object","optional":true,
        "additionalProperties":{
          "type":"string","format":"uri"
        }
      },
      "categories":{"type":"array","optional":true,"items":{"type":"string"}},
      "author":{"type":"string","optional":true},
      "links":{"type":"object","optional":true,"properties":{
        "alternate":{"type":"object","optional":true,"properties":{
          "type":{"type":"string"},
          "title":{"type":"string","optional":true},
          "href":{"type":"string","format":"uri"}
          }
        },
        "related":{"type":"object","optional":true,"properties":{
          "type":{"type":"string"},
          "title":{"type":"string","optional":true},
          "href":{"type":"string","format":"uri"}
          }
        }
      },
      "additionalProperties":{"type":"object"}
    },
    "additionalProperties":{"type":"any"}
  }
}

An actual JSON feed response returning MARCXML records:

{
    "type": "feed",
     "totalResults": 6077,
     "time": "2008-09-30T16:11:03-04:00",
     "offset": 0,
     "request": "http://demo.jangle.org/openbiblio/resources/",
     "alternate_formats": 
     {
       "http://jangle.org/vocab/formats#http://purl.org/dc/elements/1.1/": "http://demo.jangle.org/openbiblio/resources/?format=dc",
       "http://jangle.org/vocab/formats#http://www.loc.gov/mods/v3": "http://demo.jangle.org/openbiblio/resources/?format=mods",
       "http://jangle.org/vocab/formats#http://www.openarchives.org/OAI/2.0/oai_dc/": "http://demo.jangle.org/openbiblio/resources/?format=oai_dc",
       "http://jangle.org/vocab/formats#application/marc21": "http://demo.jangle.org/openbiblio/resources/?format=marc"
     },
     "formats":["http://jangle.org/vocab/formats#http://www.loc.gov/MARC21/slim"],
     "data": 
    [
        {
            "alternate_formats": 
            {
                "http://jangle.org/vocab/formats#http://purl.org/dc/elements/1.1/": "http://demo.jangle.org/openbiblio/resources/5878?format=dc",
                 "http://jangle.org/vocab/formats#http://www.loc.gov/mods/v3": "http://demo.jangle.org/openbiblio/resources/5878?format=mods",
                 "http://jangle.org/vocab/formats#http://www.openarchives.org/OAI/2.0/oai_dc/": "http://demo.jangle.org/openbiblio/resources/5878?format=oai_dc",
                 "http://jangle.org/vocab/formats#application/marc21": "http://demo.jangle.org/openbiblio/resources/5878?format=marc"
            },
             "links": 
            {
                "alternate": 
                [
                    {
                        "type": "text/html",
                         "title": "Link to native interface",
                         "href": "http://catalog.jangle.org/openbiblio/shared/biblio_view.php?bibid=5878\u0026tab=opac"
                    }
                ],
                 "related": 
                [
                    {
                        "type": "application/atom+xml",
                         "href": "http://demo.jangle.org/openbiblio/resources/5878/collections/"
                    }
                ]
            },
             "title": "The Untamed",
             "author": "Brand, Max,",
             "updated": "2008-03-18T15:57:00-04:00",
             "categories": 
            [
                "opac"
            ],
             "content": "\u003Crecord xmlns='http://www.loc.gov/MARC21/slim'\u003E\u003Cleader\u003E      Z   22        4500\u003C/leader\u003E\u003Cdatafield tag='245' ind1='0' ind2='0'\u003E\u003Csubfield code='a'\u003EThe Untamed\u003C/subfield\u003E\u003Csubfield code='b'\u003E\u003C/subfield\u003E\u003Csubfield code='c'\u003Eby Max Brand\u003C/subfield\u003E\u003C/datafield\u003E\u003Cdatafield tag='100' ind1='0' ind2='z'\u003E\u003Csubfield code='a'\u003EBrand, Max\u003C/subfield\u003E\u003C/datafield\u003E\u003Cdatafield tag='42' ind1='z' ind2='z'\u003E\u003Csubfield code='a'\u003Edc\u003C/subfield\u003E\u003C/datafield\u003E\u003Cdatafield tag='100' ind1='z' ind2='z'\u003E\u003Csubfield code='d'\u003E1892-1944\u003C/subfield\u003E\u003C/datafield\u003E\u003Cdatafield tag='245' ind1='z' ind2='z'\u003E\u003Csubfield code='h'\u003E[electronic resource]/\u003C/subfield\u003E\u003C/datafield\u003E\u003Cdatafield tag='260' ind1='z' ind2='z'\u003E\u003Csubfield code='b'\u003EProject Gutenberg,\u003C/subfield\u003E\u003Csubfield code='c'\u003E2004\u003C/subfield\u003E\u003C/datafield\u003E\u003Cdatafield tag='500' ind1='z' ind2='z'\u003E\u003Csubfield code='a'\u003EProject Gutenberg\u003C/subfield\u003E\u003C/datafield\u003E\u003Cdatafield tag='506' ind1='z' ind2='z'\u003E\u003Csubfield code='a'\u003EFreely available.\u003C/subfield\u003E\u003C/datafield\u003E\u003Cdatafield tag='516' ind1='z' ind2='z'\u003E\u003Csubfield code='a'\u003EElectronic text\u003C/subfield\u003E\u003C/datafield\u003E\u003Cdatafield tag='830' ind1='z' ind2='z'\u003E\u003Csubfield code='a'\u003EProject Gutenberg\u003C/subfield\u003E\u003Csubfield code='v'\u003E10886\u003C/subfield\u003E\u003C/datafield\u003E\u003Cdatafield tag='856' ind1='z' ind2='z'\u003E\u003Csubfield code='u'\u003Ehttp://www.gutenberg.org/etext/10886\u003C/subfield\u003E\u003Csubfield code='3'\u003ERights\u003C/subfield\u003E\u003C/datafield\u003E\u003Cdatafield tag='856' ind1='z' ind2='z'\u003E\u003Csubfield code='u'\u003Ehttp://www.gutenberg.org/license\u003C/subfield\u003E\u003C/datafield\u003E\u003C/record\u003E",
             "content_type": "application/xml",
             "format":"http://jangle.org/vocab#http://www.loc.gov/MARC21/slim",
             "created": "2008-03-18T15:57:00-04:00",
             "id": "http://demo.jangle.org/openbiblio/resources/5878",
             "relationships": 
            {
                "http://jangle.org/rel/related#Collection": "http://demo.jangle.org/openbiblio/resources/5878/collections/"
            }
        }
    ]
}

The definitions of each field are:

type:
Sets the feed type to allow the Jangle core to set the proper serialization of the JSON response. This can be either "feed" or "search" depending on the request type.
request:
The URI of the requested resource (including query parameters).
time:
An ISO 8601 formatted timestamp denoting when the response was created.
offset:
The offset (from zero) of the first entry in the result set.
totalResults:
The number of resources available at this URI.
extensions:
A hash of namespaces of any extension data being send in the results. The syntax is "extensions": {"xmlns prefix:{"xmlns":"Namespace URI","xsd":"Schema URL (optional)"}}
alternate_formats:
A hash of the URIs of feeds that represent the same resources in a different data format. Takes the form: "alternate_formats":{"Jangle URI of format (i.e. http://jangle.org/vocab/formats#http://purl.org/dc/elements/1.1/)":"URI of resource with alternate format"}
stylesheets:
An optional array of XSLT stylesheet URLs to transform the data after it has been serialized as Atom. The stylesheets will be applied in the order of the array.
categories:
An optional array of category terms that apply to the resource.
formats:
An array of Jangle Format URIs that appear in the current list of resources.
data:
An array of objects that contain the actual resources requested.

The objects in the data array have the following elements:

id:
The URI of the resource.
title:
A human readable string to identify the resource.
updated:
An ISO 8601 formatted timestamp of the last modification time of the resource.
created:
An optional ISO 8601 formatted timestamp of the creation date of the resource.
description:
A human readable description of the resource. Optional.
content:
This element contains the actual resource data itself in the format requested by the client. While technically "optional", this element should only be omitted if the client explicitly requests the results in Atom. The content element requires the presence of content_type in the same object.
content_type:
The mime-type of the content element. Required if the content element exists.
format:
The Jangle Format URI of the data in the "content" element.
stylesheet:
The URL of an XSLT stylesheet to apply to the data contained in the content element. Optional.
alternate_formats:
A hash of the URIs of feeds that represent the same (single) resource in a different data format. Same syntax as the root level element.
relationships:
A hash of feeds of resources related this resource. Takes the form: "relationships":{"Jangle URI of related entity (i.e. http://jangle.org/vocab/Entity#Item)":"URI to resource"}
categories:
An optional array of category terms that apply to the resource.
author:
An optional string identifying the creator of the resource.
links:
A representation of the Atom link element. These do not need to include alternate_formats and relationships links.

Additional elements can be added to data objects, their keys need to conform to a convention of xmlns_prefix:element_name. Object syntax of data contained in an extension element has not yet been decided.