我正在尝试集成Yammer REST API,以根据文档https://developer.yammer.com/docs/messages-json-post使用具有附件的JAVA将消息发布到组中。
到目前为止,什么对我有用:
但是,我无法
下面是代码段-
File fileToUse = new File("logo.png");
FileBody fileBody = new FileBody(fileToUse, ContentType.MULTIPART_FORM_DATA);
StringBody stringBody1 = new StringBody("12345", ContentType.MULTIPART_FORM_DATA);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addPart("attachment1", fileBody);
builder.addPart("group_id", stringBody1);
HttpEntity entity = builder.build();
httpPost.setEntity(entity);
HttpResponse response = client.execute(httpPost);
有人遇到这个问题吗?感谢您对此的想法。
得到以下错误:
HttpResponseProxy {HTTP / 1.1 500 Internal Server Error [X-Cell-Id:5,X-Network-Id:13570,Strict-Transport-Security:max-age = 1234513412313; includeSubDomain,X-Robots-Tag:无,X-Lodbrok-Cell:prod_central_1_static-c5,X-MSEdge-Ref:Ref A:A7FDC286B58B43A1A70D5F197905860B Ref B:CH1EDGE1105 Ref C:2019-08-01T20:14:48Z,日期:Thu ,2019年8月1日20:14:48 GMT,Content-Length:0] [Content-Length:0,Chunked:false]} [Content-Length:0,Chunked:false]