Yammer attachments - how do I use the pending_attachments call?

谁都会走 提交于 2019-12-25 03:43:01

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/30221415/yammer-attachments-how-do-i-use-the-pending-attachments-call

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!