M
Matìj Cepl
Hi,
I've got an idea to make a simple Java program to push locally stored
atom file to Blogger. For that I need to know which entry from the local
file was already published to the server and which not. A moment of
studying the problem I've found perfectly suitable part of Atom format
for it ... <atom:source><atom:id>oldURI</atom:id></atom:source> can
preserve my old ID!
So, I've wrote
http://repo.or.cz/w/jPostBlog.git/blob/master:/src/eu/cepl/postBlog/PostBlog.java
and hoped it will work. After beating hopelessly again HTTP Error 400
Bad Request for some time, I've discovered that the culprit is exactly
<atom:source> element.
See http://code.google.com/p/gdata-issues/issues/detail?id=1912 for
simple reproducer. Just with this Atom entry file:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<title>John 3:17 or The Golden Middle Ground Between Grace and
Sanctification?</title>
<source><id>urn:atomid:ceplovi.cz:atom1:blog:jan-3_17-2008-07-10</id></source>
<updated>2008-07-13T00:00:00+02:00</updated>
<content type="xhtml" xml:lang="en">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>There is a couple of things, which make for me sense together
(and I am not sure, of course, whether they will make sense to
... discussion I would like to have with Dave.</p>
</div>
</content>
</entry>
and this script:
#!/bin/sh
# Authenticate
G_AUTH_TOKEN=$(curl 2>/dev/null
https://www.google.com/accounts/ClientLogin \
-d Email=GoogleLogin \
-d Passwd=passwd \
-d accountType=GOOGLE \
-d source=curlExample \
-d service=blogger \
| grep '^Auth=' | cut -c 6-)
# Post on my blog.
curl -v --request POST -H "Content-Type: application/atom+xml;
charset=utf-8" \
-H "Authorization: GoogleLogin auth=$G_AUTH_TOKEN" \
"http://www.blogger.com/feeds/1595365174292209830/posts/default" \
--data "@test-entry.atom"
I get 400 Bad Request. When I remove <atom:source> element from the
file, post gets created perfectly.
Do I do anything wrong with <atom:source> element, or is Blogger broken?
Does anybody know whether Wordpress (my other candidate for blogging
platform, actually I would prefer, I am trying to move away from Google
as much as possible) or any other freely available blogging platform
works better?
Thanks a lot,
Matìj Cepl
--
http://www.ceplovi.cz/matej/, Jabber: mcepl<at>ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
He uses statistics as a drunken man uses lamp-posts... for
support, rather than illumination.
-- Andrew Lang
I've got an idea to make a simple Java program to push locally stored
atom file to Blogger. For that I need to know which entry from the local
file was already published to the server and which not. A moment of
studying the problem I've found perfectly suitable part of Atom format
for it ... <atom:source><atom:id>oldURI</atom:id></atom:source> can
preserve my old ID!
So, I've wrote
http://repo.or.cz/w/jPostBlog.git/blob/master:/src/eu/cepl/postBlog/PostBlog.java
and hoped it will work. After beating hopelessly again HTTP Error 400
Bad Request for some time, I've discovered that the culprit is exactly
<atom:source> element.
See http://code.google.com/p/gdata-issues/issues/detail?id=1912 for
simple reproducer. Just with this Atom entry file:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<title>John 3:17 or The Golden Middle Ground Between Grace and
Sanctification?</title>
<source><id>urn:atomid:ceplovi.cz:atom1:blog:jan-3_17-2008-07-10</id></source>
<updated>2008-07-13T00:00:00+02:00</updated>
<content type="xhtml" xml:lang="en">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>There is a couple of things, which make for me sense together
(and I am not sure, of course, whether they will make sense to
... discussion I would like to have with Dave.</p>
</div>
</content>
</entry>
and this script:
#!/bin/sh
# Authenticate
G_AUTH_TOKEN=$(curl 2>/dev/null
https://www.google.com/accounts/ClientLogin \
-d Email=GoogleLogin \
-d Passwd=passwd \
-d accountType=GOOGLE \
-d source=curlExample \
-d service=blogger \
| grep '^Auth=' | cut -c 6-)
# Post on my blog.
curl -v --request POST -H "Content-Type: application/atom+xml;
charset=utf-8" \
-H "Authorization: GoogleLogin auth=$G_AUTH_TOKEN" \
"http://www.blogger.com/feeds/1595365174292209830/posts/default" \
--data "@test-entry.atom"
I get 400 Bad Request. When I remove <atom:source> element from the
file, post gets created perfectly.
Do I do anything wrong with <atom:source> element, or is Blogger broken?
Does anybody know whether Wordpress (my other candidate for blogging
platform, actually I would prefer, I am trying to move away from Google
as much as possible) or any other freely available blogging platform
works better?
Thanks a lot,
Matìj Cepl
--
http://www.ceplovi.cz/matej/, Jabber: mcepl<at>ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
He uses statistics as a drunken man uses lamp-posts... for
support, rather than illumination.
-- Andrew Lang