{"id":293,"date":"2007-03-12T07:43:34","date_gmt":"2007-03-12T14:43:34","guid":{"rendered":"http:\/\/www.red-sweater.com\/blog\/293\/really-simple-discovery"},"modified":"2007-03-12T07:43:37","modified_gmt":"2007-03-12T14:43:37","slug":"really-simple-discovery","status":"publish","type":"post","link":"https:\/\/redsweater.com\/blog\/293\/really-simple-discovery","title":{"rendered":"Really Simple Discovery"},"content":{"rendered":"<p>As I mentioned in my <a href=\"http:\/\/www.red-sweater.com\/blog\/292\/marsedit-for-your-custom-blog\">last post<\/a>, Really Simple Discovery is a mechanism by which blog editors (such as <a href=\"http:\/\/www.red-sweater.com\/marsedit\/\">MarsEdit<\/a>) can programmatically obtain information about the publishing APIs a particular blog supports.<\/p>\n<p>\nMost of the &#8220;big blogs&#8221; support this feature, albeit to varying degrees of usefulness. Take a look at the source code to this page, if you&#8217;re reading it on the web. You&#8217;ll see near the top of the page a line like this:\n<\/p>\n<p>\n&lt;link rel=&#8221;EditURI&#8221; type=&#8221;application\/rsd+xml&#8221; title=&#8221;RSD&#8221; href=&#8221;http:\/\/www.red-sweater.com\/blog\/xmlrpc.php?rsd&#8221; \/&gt;\n<\/p>\n<p>\nSee the href= section? That&#8217;s pointing at a separate URL where my blog advertises information about how it can be programmatically edited. The idea is the user gives MarsEdit a simple home page URL, and MarsEdit can go work out the details of the interaction with the blog, by examining its RSD file.\n<\/p>\n<p>\nAs you can probably imagine, my new role as the principal developer of a popular weblog-publishing application, requires me to be pretty familiar with this format and with the contents of RSD files on various sites. It hasn&#8217;t taken me long to get sick of manually looking up the RSD for a particular page, and loading it in a separate window. I want to see the RSD, and I want to see it now!\n<\/p>\n<\/p>\n<p style=\"margin-left: 2em\"><b><a href=\"javascript:function%20loadXMLDoc(url)%20{req%20=%20false;%20if(window.XMLHttpRequest%20&#038;&#038;%20!(window.ActiveXObject))%20{%20try%20{req%20=%20new%20XMLHttpRequest();%20}%20catch(e)%20{req%20=%20false;%20}%20}%20else%20if(window.ActiveXObject)%20{%20try%20{%20req%20=%20new%20ActiveXObject('Msxml2.XMLHTTP');%20}%20catch(e)%20{%20try%20{%20req%20=%20new%20ActiveXObject('Microsoft.XMLHTTP');%20}%20catch(e)%20{%20req%20=%20false;%20}}%20}if(req)%20{req.onreadystatechange%20=%20processReqChange;req.open('GET',%20url,%20true);req.send('');}return%20req;}function%20processReqChange()%20{%20if%20(req.readyState%20==%204)%20{%20if%20(req.status%20==%20200)%20{alert(req.responseText)%20}%20else%20{%20alert('There%20was%20a%20problem%20retrieving%20the%20XML%20data:%20'%20+%20req.statusText);%20}%20}}function%20GetHrefForLinkWithType(theLinkType){var%20myLinkList%20=%20document.getElementsByTagName('link');for%20(i=0;%20i<myLinkList.length;%20i++){var%20thisLinkTypeTag%20=%20myLinkList[i].type;if%20(thisLinkTypeTag){if%20(thisLinkTypeTag.toLowerCase()%20==%20theLinkType.toLowerCase()){return%20myLinkList[i].href;}}}return%20-1;}var%20req%20=%20false;var%20myHref%20=%20GetHrefForLinkWithType('application\/rsd+xml');if%20(myHref%20==%20-1){alert('No%20RSD%20link%20found%20for%20this%20page.');}else{loadXMLDoc(myHref)}\">Show RSD<\/a><\/b><\/p>\n<p>\nGo ahead, click it. You should see an alert appear with the content&#8217;s of my blog&#8217;s RSD file displayed. Better yet, if you&#8217;re in the unusual position of needing to look at these things all the time, you can drag the above link to your bookmarklet bar, for convenient access whenever you&#8217;re staring at a blog you&#8217;d like to discover.\n<\/p>\n<p>\nPersonally I tend not to use bookmarklets, preferring to package up the JavaScript in an AppleScript so that I can easily attach it to a keyboard shortcut with <a href=\"http:\/\/www.red-sweater.com\/fastscripts\/\">FastScripts<\/a>. From now on it&#8217;s Cmd-Opt-R for RSDs in Safari.\n<\/p>\n<p>\nCredit: The Bookmarklet contains code from Apple&#8217;s excellent <a href=\"http:\/\/developer.apple.com\/internet\/webcontent\/xmlhttpreq.html\">documentation<\/a> on the subject of XMLHTTPRequest. My first time using the handy little beast!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I mentioned in my last post, Really Simple Discovery is a mechanism by which blog editors (such as MarsEdit) can programmatically obtain information about the publishing APIs a particular blog supports. Most of the &#8220;big blogs&#8221; support this feature, albeit to varying degrees of usefulness. Take a look at the source code to this [&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,4],"tags":[],"class_list":["post-293","post","type-post","status-publish","format-standard","hentry","category-marsedit","category-web"],"_links":{"self":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts\/293","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=293"}],"version-history":[{"count":0,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts\/293\/revisions"}],"wp:attachment":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/media?parent=293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/categories?post=293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/tags?post=293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}