logstore
This article is a stub. You can help the IndieWeb wiki by expanding it.
Logstore is an endpoint for storing and retrieving logs from an indieweb site. Web apps and native apps (e.g. iPhone, Android) can use Logstore to store chatroom messages or direct messages as well as recall that history to give context to messaging. It can also be used to store any dated log entries so that system logs and software logs can be stores as though the software or system is the author of the message.
IndieWeb Examples
Examples of IndieWeb sites that support the micropub API (in order of deployment).
Postly
Ben Roberts has started saving IRC chatroom logs directly to Postly as an initial test case.
How to implement
How to implement the Logstore API, both in a client that can discover an endpoint and publish to it, and on a server to support an endpoint to append/recall logs.
Endpoint Discovery
It should be possible to configure an API client by authenticating as your domain name using IndieAuth. After signing in, your domain needs a way to specify the API endpoint the client will use to create new posts.
Add a <link> tag in the HTML head of your home page, or send an HTTP Link header.
HTTP Header
Link: <https://example.com/logstore>; rel="logstore"
HTML Head
<link rel="logstore" href="https://example.com/logstore">
Authentication
This is done exactly like Micropub#How_to_implement
HTTP Header
Authorization: Bearer XXXXXXXX
Form-Encoded Body Parameter
access_token=XXXXXXXXX
Scope
Ben Roberts uses the scope 'logs' for access read/write from the logstore endpoint.
Log Storage Format
Logs are stored as h-feeds with h-entries (each containing an author) in microformats
Getting List of Log Feeds
Making an HTTP GET request without an 'h=' option should return a list of feeds that can be accessed in the form...
<a class="h-feed u-url" href="https://ben.thatmustbe.me/logstore?h=feed&url=irc://freenode.net/%23indiechat"> irc://freenode.net/#indiewebcamp </a>
Remember to escape any Hash marks in the URL as they are needed for IRC room names.
Storing Log Entries
Making a POST request to the endpoint with
h=entry
should store the log entry.
Add the values to be stored similar to Micropub
h=entry content=GWG not really on you? in-reply-to=irc://freenode.net/#indiewebcamp published=2015-03-11 07:37:07 author_name=pfefferle
Recalling Log Feed
Making an HTTP GET request with 'h=feed' and 'url=' for the feed identifier
Example Log Feed
<div class="h-feed"> <div class="h-entry"> <time class="dt-published" datetime="2015-03-11 07:37:07"> 2015-03-11 07:37:07 </time> <span class="p-author h-card"> <span class="p-nickname p-name">pfefferle</span> </span> <span class="e-content p-name">GWG not really on you?</span> </div> </div>
Brainstorming
This entire page is still under developement, and there are several pieces that still need to be worked out.
- Should there be a difference in read and write scope?
- Storing of direct messages should ideally be able to unify to an actual person. It would be nice to have a way to mark up on what method a message was delivered via.
- Should the be a way to delete / clear logs?
- There will need to be a method of paging when polling a log, or at least a method to say how much to limit to.
- Barnaby Walters suggested [1] using next/prev markup and have an extra value of before= and a timestamp so they are permanent. I would recommend something like ls-before to follow the prefix idea of micropub (mp-xxxx).
- Currently I am not logging chat entry/exit, there should probably be some markup for these.
- Currently I am not logging actions, there should be some markup for this.
- There should likely be a good way to store and recall a 'last-read' value for each feed so you can easily determine if there are any new messages.