Singpolyma

Archive of "Apis"

Archive for the "Apis" Category

Content Publishing Protocol

Posted on

Since APP (understand here) is mainlined in WordPress, it makes sense to use it in DiSo efforts.  I doubt that my OAuth plugin will work here, but it’s worth testing.  It may mean using headers, but with comment and discovery support we should be able to build a distributed commenting system, at least for WordPress.

I’ve thought about other APIs that would be useful for DiSo.  For example, adding friends or groups.  APP does not fit this, but the general concepts do.  Perhaps APP can be abstracted into more of a CPP.

GET on main endpoint to list items (ATOM can always be the main wrapper here).

POST to main endpoint to create new items.

PUT to node to edit.

DELETE to node to delete.

Authentication unspecified (HTTP Basic or OAuth work well).

If the content of your POST and PUT requests is ATOM, you have AtomPub.  The same basics can easily work with other content.  (The other content types could be encapsulated in ATOM entry bodies on the GET list, or XOXO).

For example, a POST body of XFN+hCard could add a friend.  A PUT body of hCard could edit a profile (ie, to add groups).

I would also like to suggest that POST on a node could be used to add comments (create new content on a content node).

Why the SGNodeMapper is a bad idea

Posted on

Don’t get me wrong, I love Google’s Social Graph API, it’s a great way to speed up the discovery of XFN data by using Google’s cache.  What does not make sense to me, however, is their ‘NodeMapper’ concept that is built in to the API.  It maps multiple URLs from a site on to, not a single URL, but a SGAPI-only URI scheme.  It maps using URL patterns that are known about the site, so it doesn’t even work on the web in general.  When it does work, what is it useful for?  URL consolidation.  The problem is, that the only thing you can do with a nodemapped URI is (1) use it as a unique key or (2) turn it back into a URL to get data.

I don’t get it guys.  How is this better?  Is there even a reason to consolidate things like FOAF files backwards to the main page, since most people will enter the main page itself as input anyway?  Even if it was useful, shouldn’t it actually map to the main page and not to some proprietary URI scheme?

Thoughts?  Anyone see a use for this that I’m missing?  Or is this misfeature just adding a layer of data that someone might use and that we’ll have to hack around again later?

Datatypeing

Posted on

There is some work going on at the microformats site to provide a datatypeing mechanism for microformats. XOXO being the most flexible format, it stands to gain much from such a system. While the work is as yet not done, it has come a fair way since I first saw it. Here is a basic overview of the system as it applies to XOXO :

Add the class ‘typed’ to the root XOXO element to specify that this XOXO makes use of datatypeing. Then, to each ‘a’ or ‘dd’ tag add one of the following classes:

  • ‘string’ for strings (this is the default if you do not specify a datatype class)
  • ‘boolean’ for boolean values (should be in page as ‘1’ or ‘0’)
  • ‘int’ or ‘long’ for integer values
  • ‘double’ for decimal values
  • ‘datetime’ for dates and times (should be encoded using the datetime-design-pattern)
  • ‘binary’ for binary data (should be encoded using a data URI)
  • ‘nil’ for NULL values

Note that other field types (such as HREF and TITLE) will simply always be treated as strings and this can only be applied to the direct contents of ‘a’ or ‘dd’ field-tags.

XOXO Developer’s Resources

Posted on

This is a collection of code resources and APIs for developers looking to work with XOXO in their scripts/applications. There isn’t much here yet, but the list will grow over time.

PHP
On some of these, the comments may state that attributes of the first node are considered to be metadata for the entire outline. This is actually up to the developer and the format of XOXO being parsed as there is nothing in the code to facilitate/enforce it.

  • Outline Classes [GPL] — A set of PHP4 and PHP5 comatible classes for both parseing and creating outline data, including XOXO, OPML, hAtom, JSON, and arbitrary XML.

The following, deprecated APIs, have been replaced by the Outline Classes

  • xoxo2array [GPL] — pass in any string containing XOXO data and it will return a nested array of the results. String indexes are considered attributes, numeric indexes are subnodes.
  • array2xoxo [GPL] — takes an array of the type returned by xoxo2array and returns an XOXO string of the data. It will also work with simple arrays.
  • There are also other APIs for working with this array type (for conversion purposes, etc)

Python

Java

  • XOXOWriter.java [Apache 2.0] — Contains two (overloaded) functions, makeXOXO and toXOXO, that create XOXO data from Lists and create XOXO documents from XOXO data, respectively
  • XOXOParser.java [Apache 2.0] — Contains a class definition for objects that parse XOXO data into themselves