Six Apart Developer Center

Developer Center Home » Atom » Protocol »

Updating an Atom Entry

Posted by Byrne Reese on January 23, 2006

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

Sample Response

Perl Code Sample

Comments

I see:

Error on PUT http://mydomain.com/mt/mt-atom.cgi/1.0/blogid=98/entryid=9724: 500 Can't call method "body" on an undefined value at lib/MT/AtomServer.pm line 654.

my $res = $api->updateEntry($EditURI, $entry); unless (defined $res) { print $api->errstr, “\n”; exit; }

…Oops hit “Post” prematurely…

That’s with: Movable Type Enterprise version 4.23-en.

The relevant code in ./lib/MT/AtomServer.pm is:

$entry->text(encodetext(MT::I18N::utf8off($atom->content()->body()),’utf-8’,$enc));

That suggests that $atom-content() is undefined.

I’m setting content in the client per http://search.cpan.org/dist/XML-Atom-0.23/lib/XML/Atom/Entry.pm though.

I was wondering if this is a known issue?

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.