Not a developer? Go to MovableType.com

Documentation

Updating an entry

To update an Atom entry, it is recommended that clients first retrieve a complete representation of that entry, as it is not guaranteed that an <entry> element contained within an Atom feed will have all the information about that entry (see retrieving an Atom Entry).

Once you have retrieved the Atom entry you are free to modify the elements that need to be updated. When you are finished, you post your changes back to the Atom service from which the entry was retrieved via an authenticated HTTP PUT operation.

If the operation is successful, the Atom server will return an HTTP status code of 200, and a copy of the entry that was updated. For many clients, the HTTP status code is enough. But for some clients the Atom entry returned in the response can be helpful if the client needs to record the server’s “last updated” timestamp for the entry, or to inspect any other server generated meta data associated with the entry.

Sample Request

PUT /t/atom/weblog/blog_id=1 HTTP/1.1
Host: www.typepad.com
X-WSSE: my credentials

<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Trip to the Lake</title>
  <dc:subject>Vacation</dc:subject>
  <content type="application/xhtml+xml" mode="xml"><div xmlns="http://www.w3.org/1999/xhtml"><img src="http://example.typepad.com/photos/vacation/lake-thumb.jpg" /> Here is a picture of me at the lake.</div></content>
</entry>

Sample Response

HTTP/1.1 200
Content-Type: application/x.atom+xml

<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://purl.org/atom/ns#">
  <title>Trip to the Lake</title>
  <content mode="xml"><div xmlns="http://www.w3.org/1999/xhtml"><img src="http://example.typepad.com/photos/vacation/lake-thumb.jpg" /> Here is a picture of me at the lake.</div></content>
  <issued>2003-10-23T18:35:51Z</issued>
  <link rel="alternate" href="http://example.typepad.com/weblog/2003/10/trip_to_the_lake.html" type="text/html" />
  <id>tag:typepad-com:post:3</id>
  <link rel="service.edit" href="http://www.typepad.com/t/atom/weblog/blog_id=1/entry_id=3" title="Trip to the Lake" type="application/x.atom+xml" />
</entry>

Sample Perl Code

#!/usr/bin/perl

use XML::Atom::Client;
use XML::Atom::Entry;

my $BLOG_ID = '131501';
my $USERNAME = 'your username';
my $PASSWORD = 'your password';

my $api = XML::Atom::Client->new;
$api->username($USERNAME);
$api->password($PASSWORD);

my $FeedURI = 'http://reesespieces.typepad.com/majordojo/atom.xml';

my $feed = $api->getFeed($FeedURI);
my @entries = $feed->entries;
foreach my $entry (@entries) {
    my @links = $entry->link();
    my $EditURI;
    foreach my $l (@links) {
        if ($l->rel eq 'service.edit') {
            $EditURI = $l->href;
        }
    }
    my $e = $api->getEntry($EditURI);
    print $e->title . "\n";
    $e->title($e->title . " (modified)");
    $api->updateEntry($EditURI,$e);
}
Back