{"id":182,"date":"2007-10-19T17:02:40","date_gmt":"2007-10-19T17:02:40","guid":{"rendered":"http:\/\/beta.robertprice.co.uk\/robblog\/2007\/10\/atom_posting_to_movable_type-shtml\/"},"modified":"2007-10-19T17:02:40","modified_gmt":"2007-10-19T17:02:40","slug":"atom_posting_to_movable_type-shtml","status":"publish","type":"post","link":"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/","title":{"rendered":"Atom Posting To Movable Type"},"content":{"rendered":"<p>\nFor the <a href=\"http:\/\/www2.qawards.co.uk\/\">Q Awards 2007<\/a>, we wanted to have minute by minute blogging.\n<\/p>\n<p>\n<a href=\"http:\/\/www2.qawards.co.uk\/minute.html\"><img loading=\"lazy\" decoding=\"async\" src=\"\/robblog\/images\/qawardsbyminute.gif\" alt=\"q awards minute by minute\" width=\"470\" height=\"289\" class=\"blogimage\" \/><\/a>\n<\/p>\n<p>\nWe used <a href=\"http:\/\/www.movabletype.com\/\">Movable Type<\/a> for the website, but didn&#8217;t want to have to rely on having a laptop available to blog from, so blogging from a mobile phone was the approach we took.\n<\/p>\n<p>\nOriginally we looked at <a href=\"http:\/\/twitter.com\/\">Twitter<\/a> for this, but we worried about connection speed. We also looked at <a href=\"http:\/\/www.nokia.com\/lifeblog\">Nokia Lifeblog<\/a>, while good, it doesn&#8217;t really allow for just headline posting. Finally, we took the custom code approach.\n<\/p>\n<p>\nMovable Type has an <a href=\"http:\/\/en.wikipedia.org\/wiki\/Atom_(standard)\">Atom<\/a> interface, it&#8217;s what Nokia Lifeblog uses. This lets us post articles, so all we needed was a suitable client. Thankfully, using <a href=\"http:\/\/www.perl.com\/\">Perl<\/a>, there is <a href=\"http:\/\/search.cpan.org\/dist\/XML-Atom\/lib\/XML\/Atom\/Client.pm\">XML::Atom::Client<\/a>.\n<\/p>\n<p>\nBen Hammersley provides an great tutorial on using the <a href=\"http:\/\/www.benhammersley.com\/projects\/atom_api_in_movable_type.html\">Atom API in Movable Type<\/a>.\n<\/p>\n<p>\nMy code needed to take a line of text and post automatically to Movable Type in a certain category (called &#8220;livefeed&#8221;). I built a really simple HTML page that could be used by any internet enabled phone. It had one text box and one submit button. Copy entered here and submitted would appear in the Movable Type blog automatically.\n<\/p>\n<p>\nI needed some glue Perl code behind this page to make this happen. It turned out to be really simple, and here&#8217;s the core functionality. I won&#8217;t bore you with CGI handling or display code, just the Atom meat.\n<\/p>\n<div class=\"code\"><code>my $api = XML::Atom::Client-&gt;new;<br \/>\n$api-&gt;username($username);<br \/>\n$api-&gt;password($password);<br \/>\nmy $dc = XML::Atom::Namespace->new(dc =&gt; 'http:\/\/purl.org\/dc\/elements\/1.1\/');<br \/>\nmy $entry = XML::Atom::Entry-&gt;new;<br \/>\n$entry-&gt;title($title);<br \/>\n$entry-&gt;content('');<br \/>\n$entry-&gt;set($dc, 'subject', 'livefeed');<br \/>\nmy $edituri = $api-&gt;createEntry($posturl, $entry);<br \/>\nif ($edituri) {<br \/>\n## posted ok<br \/>\n} else {<br \/>\n## not posted, $api-&gt;errstr has the error message;<br \/>\n}<br \/>\n<\/code><\/div>\n<p>\nThis code assumes you have a few variables in place, those are\n<\/p>\n<ul>\n<li><var>$username<\/var> &#8211; the poster&#8217;s username<\/li>\n<li><var>$password<\/var> &#8211; the poster&#8217;s <em>web services<\/em> password<\/li>\n<li><var>$posturl<\/var> &#8211; the web service&#8217;s post url<\/li>\n<li><var>$subject<\/var> &#8211; the copy to post to the blog<\/li>\n<\/ul>\n<p>\nMovable Type has two different passwords per user, it is important we use the webservices password and not the users normal Movable Type password.\n<\/p>\n<p>\nNow we were posting and creating entries each post, we wanted to show them all on one page. my collegue <a href=\"http:\/\/www.rossmerrigan.com\/\">Ross<\/a> wrote this block of code to display the posts.\n<\/p>\n<div class=\"code\"><code>&lt;MTEntries category=\"livefeed\"&gt;<br \/>\n&lt;li&gt;<br \/>\n&lt;MTIfNonEmpty tag=\"EntryTitle\"&gt;<br \/>\n&lt;p class=\"time\"&gt;&lt;$MTEntryDate format=\"%I:%M %p\"$&gt;&lt;\/p&gt;<br \/>\n&lt;p&gt;&lt;$MTEntryTitle$&gt;&lt;\/p&gt;<br \/>\n&lt;\/MTIfNonEmpty&gt;<br \/>\n&lt;\/li&gt;<br \/>\n&lt;\/MTEntries&gt;<br \/>\n<\/code><\/div>\n<p>\nThis turned out to be a nice, fast solution to getting content up quickly on the day.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For the Q Awards 2007, we wanted to have minute by minute blogging. We used Movable Type for the website, but didn&#8217;t want to have to rely on having a laptop available to blog from, so blogging from a mobile phone was the approach we took. Originally we looked at Twitter for this, but we &hellip; <a href=\"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Atom Posting To Movable Type&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[38,41,78],"class_list":["post-182","post","type-post","status-publish","format-standard","hentry","category-dev","tag-mobile","tag-movable-type","tag-work"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Atom Posting To Movable Type - Robert Price<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Atom Posting To Movable Type - Robert Price\" \/>\n<meta property=\"og:description\" content=\"For the Q Awards 2007, we wanted to have minute by minute blogging. We used Movable Type for the website, but didn&#8217;t want to have to rely on having a laptop available to blog from, so blogging from a mobile phone was the approach we took. Originally we looked at Twitter for this, but we &hellip; Continue reading &quot;Atom Posting To Movable Type&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/\" \/>\n<meta property=\"og:site_name\" content=\"Robert Price\" \/>\n<meta property=\"article:published_time\" content=\"2007-10-19T17:02:40+00:00\" \/>\n<meta name=\"author\" content=\"rob\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rob\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/atom_posting_to_movable_type-shtml\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/atom_posting_to_movable_type-shtml\\\/\"},\"author\":{\"name\":\"rob\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"headline\":\"Atom Posting To Movable Type\",\"datePublished\":\"2007-10-19T17:02:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/atom_posting_to_movable_type-shtml\\\/\"},\"wordCount\":349,\"keywords\":[\"Mobile\",\"Movable Type\",\"Work\"],\"articleSection\":[\"Dev\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/atom_posting_to_movable_type-shtml\\\/\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/atom_posting_to_movable_type-shtml\\\/\",\"name\":\"Atom Posting To Movable Type - Robert Price\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\"},\"datePublished\":\"2007-10-19T17:02:40+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/atom_posting_to_movable_type-shtml\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/atom_posting_to_movable_type-shtml\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/atom_posting_to_movable_type-shtml\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Atom Posting To Movable Type\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\",\"name\":\"Robert Price\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\",\"name\":\"rob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"caption\":\"rob\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Atom Posting To Movable Type - Robert Price","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/","og_locale":"en_GB","og_type":"article","og_title":"Atom Posting To Movable Type - Robert Price","og_description":"For the Q Awards 2007, we wanted to have minute by minute blogging. We used Movable Type for the website, but didn&#8217;t want to have to rely on having a laptop available to blog from, so blogging from a mobile phone was the approach we took. Originally we looked at Twitter for this, but we &hellip; Continue reading \"Atom Posting To Movable Type\"","og_url":"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/","og_site_name":"Robert Price","article_published_time":"2007-10-19T17:02:40+00:00","author":"rob","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rob","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/#article","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/"},"author":{"name":"rob","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"headline":"Atom Posting To Movable Type","datePublished":"2007-10-19T17:02:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/"},"wordCount":349,"keywords":["Mobile","Movable Type","Work"],"articleSection":["Dev"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/","url":"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/","name":"Atom Posting To Movable Type - Robert Price","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website"},"datePublished":"2007-10-19T17:02:40+00:00","author":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"breadcrumb":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.robertprice.co.uk\/robblog\/atom_posting_to_movable_type-shtml\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.robertprice.co.uk\/robblog\/"},{"@type":"ListItem","position":2,"name":"Atom Posting To Movable Type"}]},{"@type":"WebSite","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website","url":"https:\/\/www.robertprice.co.uk\/robblog\/","name":"Robert Price","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.robertprice.co.uk\/robblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5","name":"rob","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","caption":"rob"}}]}},"_links":{"self":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/comments?post=182"}],"version-history":[{"count":0,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/182\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/media?parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/categories?post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/tags?post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}