我一直在尝试使用Yammer Javascript api在Yammer上发布附件。关于这一点,Yammer上没有太多可用的文档。有人能帮我做到这一点吗。
谢谢。
发布于 2018-01-10 09:51:13
希望这能帮助你解决这个问题,
您可以使用POST:/pending-attachments yammer接口在yammer中发布图片。
但是如果你想创建带有图片的yammer post,可以将POST:/messages.json与附加文件一起使用- attachment_N or pending_attachment_N作为一个多部分的表单字段。
使用此链接获取信息- Yammer message API
使用JavaScript SDK添加示例代码-
let otherFormData = {
"group_id": groupId,
"body": message,
"og_url": postUrl,
"og_fetch": false,
"og_title": title,
"og_image": og_image,
"og_description": summary,
"og_object_type": og_object_type,
"direct_to_user_ids": []
};
let formData = new FormData();
formData.append("attachment1", imgData_Base64, AfileName);
for (let i in otherFormData) {
formData.append(i, otherFormData[i]);
}
window.yam.platform.request({
url: "messages.json",
method: "POST",
data: formData,
processData: false,
contentType: false,
type: 'POST',
dataType: 'json',
success: (response) => {
console.info("The request is successful. ", response);
},
error: (err) => {
console.info("There is an error in the request.", err);
}
});https://stackoverflow.com/questions/42896378
复制相似问题