I am working with the Yammer API and I want to be able to add files to new posts created through my application. This appears to be done through the api/pending_attachments
call, but the documentation is a little sketchy and doesn't really make it clear what the pending_attachments
call is expecting - it wants an attachment
property but it's entirely unclear what that means - is it the file? Is it the file name? In most cases I can't make the test on that page do anything other than fail with a 500 error, which is less than encouraging, but if I post a file chunk in Base64 Encoded format, it does fail in a way that tells me the request is too large. If I do only have a single field how do I tell Yammer what file the chunks I am uploading belong to so it can relate them?
From this post it seems that there is a special secret and entirely unpublicised upload URL that one has to send the files to, but the upload process there seems like it might not work with chunked uploads which is what I'm currently using ( although that could be changed if necessary ) and the whole thing is very confusing.
I'm not using a specific library in this case, just interacting with the service that Yammer presents. I'm working from C#, but my question is about the Yammer API, so I'm not too worried about the language side of things.
What do I need to do in order to successfully upload pending attachments directly to Yammer?
The solution to this was that you have to be sending a
multipart/form-data
formatted request in exactly the correct format, which in my case coming from a server-side application meant building everything up in to a byte array and sending it through with the standard format.The answers to this question show how to use a standard
HttpClient
approach to this.