Posterous API for C# (and VB.NET)
Let me introduce my latest creation - Posterapi - a C# wrapper for Posterous API, complete with source code and samples!
Few months ago (see here), I discovered there was most likely no usable and free C# wrappers for Posterous API. So I decided to write one myself. It took me two months, but the first beta has just been released today
Check out Posterapi homepage and sample code for more information, or just download the latest binaries and samples or the source code (MIT-style license). All currently available features except Posterous Twitter API are implemented (let me know if you would like to have that as well).
To publish a new post with 2 photos, a simple code like this can be used:
// Initialize an authenticated posterous session
PosterousSession session = new PosterousSessio(email, password);
// Construct a new post and attach two photos
PosterousNewPost newPost = new PosterousNewPost();
newPost.Title = "New post!";
newPost.Body = "This is the body of the new post.";
newPost.Tags = "posterous, api, photo";
newPost.Files.Add("photo1.jpg");
newPost.Files.Add("photo2.png");
// Publish the post to the primary site (blog)
PosterousPostInfo postInfo = session.PublishPost(0, newPost);
// Display some information about the new post
Console.WriteLine("Published as {0}", postInfo.ShortUri);There are more samples - even a GUI posting application that is very useful for posting long videos that are not really suitable for e-mail submission.
I have to say that Posterous API doesn't really make it easy to put a nice .NET API on top of it. The available methods seem to be a random selection of its functionality. Some key functionality (at least in my opinion) is missing. Some examples:
- Even if you know an ID of a single post, you can't easily download it.
- If you know its post.ly shortcode, you can only download it if it's public - even if you are authenticated.
- You have to know a Posterous hostname of a site to be able to download its posts. If you only know its custom domain (like lukas.pokorny.eu), there is no way to determine its Posterous hostname (pokorny.posterous.com).
- Only "basic" authentication is currently available. This is not secure because the password is transferred in near-plaintext.
This means that if you feel that some part of Posterapi is not pretty, it might not necessarily be my fault ;-)
Of course, if you find something you really don't like or if something is not working as expected, please let me know. This is still a beta and I only tested the features I actually need. Report all the bugs here.
If you find this useful, please let me know!