AnsweredAssumed Answered

How would I create a discussion with an attachment from a Jive App?

Question asked by sonny.lau on Nov 18, 2012
Latest reply on Jan 13, 2014 by nnigam

I can create discussions in groups from my Jive App successfully using the JS API v2 but I can't seem to grasp how I can add attachments to the discussion.


I've taken a look at Binary Data Storage Usage and I get lost at point 2.1.2 Perform a Native HTTP POST Request. How am I supposed to perform this request? Am I on the right track in using this Binary API or is there another way to directly upload a file and attach it to a new discussion?


Update: I've managed something like this using the JS API v3 with a file hosted somewhere else.


var attachment = {doUpload: true, url: ""};
var discussion = {content: {type: 'text/html', text: '<body><p>This will be created with the v3 API</p></body>'}, subject: 'Discussion with attachments', attachments: [attachment]};
osapi.jive.corev3.discussions.create(discussion).execute(function (response) { console.log(response); });


Unfortunately, I get a 400 returned with "Attachments are not supported by this content type". Are attachments to discussions really unsupported by the API, or perhaps it's just throwing an error because it doesn't like what I attached? That would seem to contradict the documentation over here (Jive API v3.0 &rarr; osapi.jive.corev3.contents.Discussion entity).


Any tips or code samples would be appreciated,