rest - 使用 Axios Assyst REST API 发送文件
问题描述
在 Blue Prism .Net 环境中使用 HTTP 实用程序调用 Axios Assyst(IT 服务台第 3 方软件)。
我的 HTTP 请求如下:
POST /assystREST/v2/site/10/attachments/binary HTTP/1.1
Host: <myserver>:<myport>
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary<base64 encode here>
Accept: application/json
Authorization: Basic <base64 encoded key>
{
"eventId": 10010045,
"fileName": "C:\Users\Me\Desktop\MyFile.msg",
"attachment": "data:;base64,<base64 encoded file>
"onBehalfOfUser": "MR ROBOT",
"custom": {},
"attachedByUserId": <my ID>,
"name": "C:\Users\Me\Desktop\MyFile.msg",
"event":{
"assystRESTType": "event",
"assystRESTXMLType": "eventDto",
"id": 10010045
},
"attachedByUser":{
"assystRESTType": "assystUser",
"assystRESTXMLType": "assystUserDto",
"name": "Mr Robot - Test",
"id": <my ID>,
"shortCode": "MR ROBOT"
}
}
我可以创建和关闭我的工单,但无法将文件发送/保存到我新创建的工单。我得到一个HTTP STATUS CODE 410-GONE
和以下异常 JSON 响应:
{
"type": "NotFoundException",
"message": "The requested resource is not available.",
"messageKey": "rest.exceptions.NotFoundException",
"diagnostic": "Could not find resource for relative : /site/10/attachments/binary of full path: http://server:port/assystREST/v2/site/10/attachments/binary"
}
我正在遵循官方 Axios Assyst Web 服务 wiki 中的说明和指南(根据以下链接),即我在发送文件、.msg 文件和所述文件的二进制文件时使用 multipart/form-data (是的,我知道这会使文件大小增加 33%):https ://wiki.axiossystems.com/assyst10SP75Wiki/index.php/Integrations:assystREST#Attachments
我的问题是 400 状态代码表示客户端存在问题,但我已经在内部检查了正在使用的防火墙/端口,并且没有任何内容被阻止。
我重新搜索了 410 个状态代码,似乎问题出在服务器端,但服务器不愿意详细说明。
对于测试,我使用 Postman,因为它允许更大的灵活性而不是使用 Blue Prism,JSON 响应是相同的。
寻找一些关于状态代码 410 和可能的解决方案的指导,请注意,由于 Blue Prisms .net vbo,我限制了范围重新选项。
解决方案
推荐阅读
- javascript - 如何仅从 imdb 数据库中获取评级?
- c# - ASP.NET Core - 将行从一个 dev express 网格添加到另一个
- android - 如何以编程方式设置 ConstraintLayout 的 XML 属性“layout_constrainedWidth”?
- c++ - How do you choose the device to perform operations on opencv-dnn?
- javascript - 如何避免 Firefox 确认消息“要显示此页面,Firefox 必须发送将重复任何操作的信息”?
- c++ - 如何检查字符串中的特殊字符?
- javascript - 在玩笑测试中使用 expect.assertions(x) 与使用 fail()
- google-maps - What is Google Maps Platform Transition Account
- asp.net-mvc - 将布尔列渲染为真/假
- c# - Send forget password to email Asp.net code error