API: Support for attachments

The API now supports attachments. This field is used by AndStatus. Additionally the function for formatting the data is centralized.