Click here to show or hide the menubar.

Home >  Archive >  2010 >  July >  9

Previous / Next

The API for Scripting2
By Dave Winer on Friday, July 09, 2010 at 2:05 PM.

There are just a few XML-RPC entry-points.  permalink

1. scripting2.newPost (username, password, title) returns struct permalink

Called when the user clicks the New Post button in the editor. The server returns two values in the struct, newPostToken and versionServer.  permalink

newPostToken is a unique identifier. The editor must pass it back to the server the first time scripting2.savePost is called on the post. Without a correct newPostToken, the savePost call will fail. permalink

versionServer is returned to help in debugging. Clients can probably ignore it (but it may prove useful when new versions are released). permalink

2. scripting2.savePost (username, password, opmltext) returns struct permalink

This is the central routine in the API. It's how new posts are created and how existing posts are edited. permalink

All the information the server needs about the post comes from the OPML that is transmitted to it. All the information that passes back from the server is in the struct. permalink

The outline described by opmltext must have a single summit. If it has more than one summit all but the first are ignored.  permalink

The attributes of the first summit provide the incoming parameters to the savePost call.  permalink

1. created determines the official publication date of the post, thus determining where in the calendar hierarchy the post will be stored. permalink

2. text determines the title of the post.  permalink

3. storySerialNum, if present, the post has already been saved, if not a serialNum is assigned and returned. permalink

4. newPostToken is only present if the post is new, it's ignored if the post has already been saved (i.e. it already has a serialNum). It must match a previously allocated token or else the save fails. permalink

5. flNotInChronology is optional, if present and true, the post is not included in the chronology of the blog. It doesn't appear on the home page, on the daily and monthly archive page. This lets you use Scripting2 to edit web pages that are not part of the weblog. Examples could include an About page or Changes page. permalink

6. flLiveBlog is optional, if present and true, this post is used to render the live-blog feed for the site. permalink

7. flVisibleSubtext is optional, if present and true, instead of the text being collapsed by default it's expanded, for this post. This is useful when sub-text is used for documentation, for example, this doc. :-) permalink

8. domainToMap is optional. If present the server maps requests to the indicated domain to this post. The domain should be mapped, via CNAME probably, to the machine the server software is running on. This is used for changes.scripting2.com and reallysimple.org. permalink

The returned structure contains the returned values.  permalink

1. All the input parameters are included in the returned structure. permalink

2. url is the address of the post. permalink

3. ctSaves is the number of times the post has been saved. permalink

4. whenLastSave is the date/time when the post was last saved. permalink

More coming soooon. :-) permalink

RSS feed for Scripting News
This site contributes to the scripting.com community river.


© Copyright 1997-2012 Dave Winer. Last update: Thursday, August 19, 2010 at 10:24 AM Eastern. Last build: 8/26/2012; 5:50:10 PM. "It's even worse than it appears."

RSS feed for Scripting News

Previous / Next