{"id":292,"date":"2007-03-11T15:54:16","date_gmt":"2007-03-11T22:54:16","guid":{"rendered":"http:\/\/www.red-sweater.com\/blog\/292\/marsedit-for-your-custom-blog"},"modified":"2012-04-25T07:47:40","modified_gmt":"2012-04-25T11:47:40","slug":"marsedit-for-your-custom-blog","status":"publish","type":"post","link":"https:\/\/redsweater.com\/blog\/292\/marsedit-for-your-custom-blog","title":{"rendered":"MarsEdit For Your Custom Blog"},"content":{"rendered":"<p>Although the vast majority of <a href=\"http:\/\/www.red-sweater.com\/marsedit\/\">MarsEdit<\/a> users are using it to manage posts on one of the big publicly available blogging systems, there are a good number of users, especially in the tech community, who run their own custom blog or blog-like software. I&#8217;ve received several private inquiries and this <a href=\"http:\/\/www.red-sweater.com\/forums\/viewtopic.php?pid=530#530\">public one<\/a>, all asking about the steps required to get MarsEdit working with a custom piece of hosting software.<\/p>\n<p>\nMany have suggested that it would help for MarsEdit to support some kind of plugin system whereby custom software authors could develop a script or piece of code to help MarsEdit interface with the site. This general line of thinking is the right one, but the plugin is probably more appropriate for the <em>server<\/em> than for the client.\n<\/p>\n<p>\nSo how do you get MarsEdit working with your custom server software? You adopt a standard API and implement it for your site, in the form of a &#8220;xmlrpc.php&#8221; type file that accepts POST requests from MarsEdit and returns the appropriate responses. This isn&#8217;t as hard as it sounds, because there are really only a few calls involved. And after all, I assume if you&#8217;ve got a custom solution already, you know your way around a bit of web programming (or you know somebody who does!).\n<\/p>\n<p>\nThe best part is that by adopting a standard API, you&#8217;ll be prepared to work with other clients besides just MarsEdit. I mean, you&#8217;d be crazy to not use MarsEdit, but I&#8217;d rather keep you as a happy customer than a locked-in one!\n<\/p>\n<p><h3>Pick An API<\/h3>\n<\/p>\n<p>\nThe first thing you&#8217;ll need to do is choose a <a href=\"http:\/\/www.xmlrpc.com\/directory\/1568\/bloggingApis\">publicly documented<\/a> API to implement. The choice is yours, but if you have no clue about which to adopt, I&#8217;d probably recommend the <a href=\"http:\/\/xmlrpc.scripting.com\/metaWeblogApi.html\">MetaWeblog API<\/a>. You&#8217;ll be in good company, since some major services such as <a href=\"http:\/\/www.wordpress.org\/\">WordPress<\/a> and <a href=\"http:\/\/spaces.live.com\/\">Microsoft Spaces<\/a> use the API for their remote editing support.<\/p>\n<h3>Observe A Working Case<\/h3>\n<\/p>\n<p>\nOnce you&#8217;ve settled no an API, I suggest setting up a working test blog that uses the API. That is, get a free blog somewhere, set it up and throw a few test posts up. Now you have a working case to compare your custom implementation against.\n<\/p>\n<p>\nMarsEdit makes it easy to examine the chit-chat that goes on between it and a given blog publishing system.  From the Window menu select &#8220;RPC Console&#8221;, and you&#8217;ll see a verbose transcript of all the messages sent from and received by MarsEdit:\n<\/p>\n<p>\n<img decoding=\"async\" src=\"http:\/\/www.red-sweater.com\/blog\/images\/RPC_Console-20070311-184324.png\"\/>\n<\/p>\n<p>\nNow you&#8217;ve got a working case to compare everything against as you iron out the details in yoru custom script.\n<\/p>\n<p><h3>Write Your Custom Script<\/h3>\n<p>Start small. Very small. Just write a simple CGI script that accepts a HTTP POST request from MarsEdit and prints out the cargo of the request. You&#8217;ll see that it matches exactly what showed up in the RPC Console. From here I would start with a single API call, probably the &#8220;getRecentPosts&#8221; call, and build your way up from there. Once you&#8217;ve got getRecentPosts working you&#8217;ll be able to see your list of blog entries show up in MarsEdit, which will surely inspire you to finish the rest!\n<\/p>\n<p>\nIf you get completely stuck, the good news is there are lots of working <em>code examples<\/em> out there as well. For instance, take a stroll down Google Code Search way on the <a href=\"http:\/\/www.google.com\/codesearch?hl=en&amp;lr=&amp;q=metaweblog&amp;btnG=Search\">MetaWeblog<\/a> term. Be mindful of the licensing of any code you find, as always.\n<\/p>\n<h3>Configure MarsEdit For Your Blog<\/h3>\n<p>You&#8217;ll actually do this as soon as you&#8217;ve got your first very small test-case of a script finished. Just click the + button beneath MarsEdit&#8217;s list of blogs to add a new one, and specify the name and URL. Obviously MarsEdit will fail to obtain meaningful information about the blog, so you&#8217;ll have to edit the information manually. Assuming I set up a custom blog using MetaWeblog, the settings window might look like this:<\/p>\n<p>\n<img decoding=\"async\" src=\"http:\/\/www.red-sweater.com\/blog\/images\/CustomBlog-20070311-190207.png\"\/><br \/>(Note: The appearance of this dialog is slightly different in 1.1.3 and earlier. Look for this new layout in MarsEdit 1.1.4 and later)\n<\/p>\n<p><h3>Extra Credit: Really Simple Discovery<\/h3>\n<\/p>\n<p>\nIf you want to spare yourself and future users of your software from the pain of manually entering the data into the settings dialog, you can describe your blog&#8217;s API support by embedding in the home page a &#8220;rel&#8221; tag identifying a specially-formatted file called an <a href=\"http:\/\/cyber.law.harvard.edu\/blogs\/gems\/tech\/rsd.html\">RSD<\/a> file. This stands for Really Simple Discovery, and is a format which MarsEdit can read to automatically determine which standard API your system uses.\n<\/p>\n<p>\nAny questions I didn&#8217;t cover? Feel free to ask in the comments.\n<\/p>\n<p><h3>Update<\/h3>\n<\/p>\n<p>\nTom Insam posted <a href=\"http:\/\/blog.zimki.com\/tomi\/2007\/02\/26\/metaweblog\">this example<\/a> a couple weeks back, where he implemented the MetaWeblog API for his site&#8217;s custom software, <a href=\"http:\/\/blog.zimki.com\/source.html\">Zimki<\/a>. Should serve as a good concrete example of the steps required.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Although the vast majority of MarsEdit users are using it to manage posts on one of the big publicly available blogging systems, there are a good number of users, especially in the tech community, who run their own custom blog or blog-like software. I&#8217;ve received several private inquiries and this public one, all asking about [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40,19,4],"tags":[],"class_list":["post-292","post","type-post","status-publish","format-standard","hentry","category-marsedit","category-technology","category-web"],"_links":{"self":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts\/292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/comments?post=292"}],"version-history":[{"count":2,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts\/292\/revisions"}],"predecessor-version":[{"id":2434,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts\/292\/revisions\/2434"}],"wp:attachment":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/media?parent=292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/categories?post=292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/tags?post=292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}