Wednesday, 31 March 2010

Wiki Posterous

/ index / WikiBlogger

Notes

To post to Posterous all you need is Curl:

 curl http://posterous.com/api/newpost -u username@domain:password -d title="Curl test" -d body="A body"  

Returns this response:

 <?xml version="1.0" encoding="UTF-8"?> <rsp stat="ok"> <post> <id>14831430</id> <url>http://post.ly/WOB8</url> <longurl>http://username.posterous.com/curl-test</longurl> <title>Curl test</title> <commentsenabled>true</commentsenabled> </post> </rsp>  

To update a post you need the post ID which you got in the response:

 curl http://posterous.com/api/updatepost -u username@domain:password -d post_id="14831430" -d body="A dead body"  

returns:

 <?xml version="1.0" encoding="UTF-8"?> <rsp stat="ok"> <post> <id>14831430</id> <url>http://post.ly/WOB8</url> <longurl>http://username.posterous.com/curl-test</longurl> <title>Curl test</title> <commentsenabled>true</commentsenabled> </post> </rsp>  

Note that the reponse includes both a short and long URL.

If you fail to supply the post id or supply one that isn't recognized you get this instead:

 <?xml version="1.0" encoding="UTF-8"?> <rsp stat="fail"> <err code="3007" msg="Invalid post id. Post not found" /> </rsp>  

So how about body text that is too long for the command line?

 curl http://posterous.com/api/newpost -u username@domain:password -d title="Big body" --data-urlencode body=@curlposterous.txt  

gives this response:

 <?xml version="1.0" encoding="UTF-8"?> <rsp stat="ok"> <post> <id>14833547</id> <url>http://post.ly/WOap</url> <longurl>http://username.posterous.com/big-body</longurl> <title>Big body</title> <commentsenabled>true</commentsenabled>  </post> </rsp>  

Posted via web from kwhitefoot's posterous

No comments:

Post a Comment

Blog Archive

Followers