We use Abdera to interact with the IBM Connections API, but our problem is mainly related to Abdera himself.
I think that there is an error in Abdera that does not allow sending a record containing content and attachments in one request. As a workaround, you can probably send two separate requests to first create content and update it using an attachment. Unfortunately, the connection API requires that all data be in the same request or that your old data is not saved.
The following code shows an Abder entry:
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
InputStream is = classloader.getResourceAsStream("google-trends.tiff");
final Abdera abdera = new Abdera();
Entry entry = abdera.getFactory().newEntry();
entry.setTitle("THIS IS THE TITLE");
entry.setContentAsHtml("<p>CONTENT AS HTML</p>");
entry.setPublished(new Date());
Category category = abdera.getFactory().newCategory();
category.setLabel("Entry");
category.setScheme("http://www.ibm.com/xmlns/prod/sn/type");
category.setTerm("entry");
entry.addCategory(category);
RequestEntity request =
new MultipartRelatedRequestEntity(entry, is, "image/jpg",
"asdfasdfasdf");
When a MultipartRelatedRequestEntity is created, NullPointer is called:
java.lang.NullPointerException
at
org.apache.abdera.protocol.client.util.MultipartRelatedRequestEntity.writeInput(MultipartRelatedRequestEntity.java:74)
, "src", Abdera , . Abdera, ?
IBM Greenhouse Connections, , , . GitHub