Feeds
A feed is a URL that answers with one page of items as JSON. The wall asks for the first page, and for the next page
when the visitor gets close to the end. The schema is feed.schema.json.
Response
Section titled “Response”{ "items": [ { "id": "12345", "link": "/listing/12345", "title": "A title", "subtitle": "Author", "image": "https://cdn.example.com/12345/512.jpg", "image_focus": "https://cdn.example.com/12345/1024.jpg", "image_full": "https://cdn.example.com/12345/full.jpg", "aspect": 1.5, "badges": ["video"], "video": "https://cdn.example.com/12345/720.mp4", "media_type": "video", "duration": 94, "projection": "flat", "stereo": "mono", "meta": { "price": "1 250 EUR", "location": "Plovdiv" } } ], "next": "eyJzIjpbMTY5"}The core fields of an item are id, link, image and aspect. An item with no picture is a text card:
it needs a title instead of image and aspect. The page has items, and next when there is more.
The other fields are listed in Item fields. media_type is not required: an item with a video is a video.
Video formats, qualities and YouTube or Vimeo links are in Video.
Cursors
Section titled “Cursors”next is an opaque string. The program passes it back untouched as cursor=<next> and never parses it. A missing or
empty next ends the feed. The wall also stops when next repeats the cursor it just sent, and after 3 pages in a row that add no new card.
Use cursors, not page numbers or offsets. A wall paginates as the visitor looks around, and an offset that shifts when the list changes repeats or skips items. A cursor that carries the sort key and the last id does not.
Page size
Section titled “Page size”50 items per page are recommended. At most 100 are allowed.
Search and filters
Section titled “Search and filters”- A feed of type
searchhas{query}in its URL. The query is URL-encoded. - A filter appends
param=valueto the feed URL. The valueallmeans no filter, and then the parameter is left out. - The wall’s own sort control adds
sort=latestorsort=popularto the feed URL, and a filter sets its parameter. Each replaces a parameter of the same name that is already in the URL, so do not usesortor a filter’s parameter for anything else. Give two feeds different paths (/wall/feed/latest,/wall/feed/popular) rather than a query parameter. titleis strongly recommended on every item, because a card whose picture fails to load shows the title.
{ "id": "search", "type": "search", "url": "/wall/feed?q={query}" }Caching
Section titled “Caching”Cache-Control is your choice. Programs do not cache feeds across sessions.
Discovery without a manifest
Section titled “Discovery without a manifest”A site that only has a feed can say so in the page:
<link rel="wall-feed" href="/wall/feed.json" title="Latest">That is Level 2 without a manifest. With a manifest you also get filters, media rules, actions and brand. See the manifest.
Read a feed from code
Section titled “Read a feed from code”import { JsonFeedAdapter } from '@diazoma/adapters';
const adapter = new JsonFeedAdapter({ url: '/wall/feed', search: '/wall/feed?q={query}' });const first = await adapter.page({});const second = await adapter.page({ cursor: first.next });Invalid items are dropped and reported through the onWarning option. See the Adapters API.