c# - 文档 | 为什么 API 返回“资源不支持 http 方法 'POST'” | C#
问题描述
我正在尝试将文件上传到 springCM 并收到此消息:
“请求的资源不支持 http 方法 'POST'。”
命中端点:
....springcm.com/v201411/folders/{folderGUID}/documents
该名称是可选的,但我尝试在 URL 中将其作为参数传递。
这是我认为相关的代码:
Uri uri = new Uri("https://....springcm.com/v201411/folders/32dsdfdb-9356-eb11-b875-45df378sdfds/documents");
Stream uploadFile = File.OpenRead(filePath + fileName);
HttpContent fileStreamContent = new StreamContent(uploadFile);
using (client = new HttpClient())
using (var formData = new MultipartFormDataContent())
{
formData.Add(fileStreamContent);
var response = await client.PostAsync(uri, formData);
if (!response.IsSuccessStatusCode)
{
Console.WriteLine(response.Content.ReadAsStringAsync().Result);
}
await response.Content.ReadAsStreamAsync();
}
我在这里做错了什么?蒂亚!
解决方案
您需要使用正确的子域,该子域应以apiupload
. 完整的 URL 应如下所示:
https://apiupload[datacenter].springcm.com/[api version]/folders/[folder identifier]/documents{?name}
更多信息:https ://developers.docusign.com/docs/clm-api/clm101/content-api/
推荐阅读
- java - 让“在 Scala 中编程”junit 示例在 IntelliJ 中工作的问题
- javascript - 在部署应用程序时,字符串值被转换为小写,如何保留原始数据
- java - 创建一个不自动使用超级构造函数的子类
- c# - 无法将类型“字符串”隐式转换为“System.Collections.Generic.List”
' c# 类获取器 - json - 在 ORACLE UTL.HTTP 中请求大型 JSON
- flutter - 将地图转换为飞镖中的列表
- reactjs - 如何使用 MUI Datatable 使用值进行排序,而不是自定义正文渲染中的内容?
- r - R:合并功能删除实际的行名
- android - 我如何告诉活动完成?
- python - 从解释器运行标头的 Python 脚本