调用后返回错误信息:
code: 404,
Specified api is not found, please check your url and method.
request id: 09FC4369-0D9D-71C3-962E-341248F56420
不知道是何原因,请帮忙看下,谢谢!
C#完整代码如下:
public static CreateTodoTaskResponseBody CreateDingTalkTodo(string creatorId, string appUrl, string pcUrl, string sourceId, string subject, string description, int dueTime
, string executorIds, string participantIds, bool isOnlyShowExecutor, int priority)
{
AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config();
config.Protocol = "https";
AlibabaCloud.SDK.Dingtalktodo_1_0.Client client = new AlibabaCloud.SDK.Dingtalktodo_1_0.Client(config);
CreateTodoTaskHeaders createTodoTaskHeaders = new CreateTodoTaskHeaders();
createTodoTaskHeaders.XAcsDingtalkAccessToken = GetToken();
CreateTodoTaskRequest.CreateTodoTaskRequestActionList.CreateTodoTaskRequestActionListParam actionList0Param = new CreateTodoTaskRequest.CreateTodoTaskRequestActionList.CreateTodoTaskRequestActionListParam();
CreateTodoTaskRequest.CreateTodoTaskRequestActionList actionList0 = new CreateTodoTaskRequest.CreateTodoTaskRequestActionList
{
Param = actionList0Param,
};
CreateTodoTaskRequest.CreateTodoTaskRequestNotifyConfigs notifyConfigs = new CreateTodoTaskRequest.CreateTodoTaskRequestNotifyConfigs
{
DingNotify = "1",
};
CreateTodoTaskRequest.CreateTodoTaskRequestContentFieldList contentFieldList0 = new CreateTodoTaskRequest.CreateTodoTaskRequestContentFieldList();
CreateTodoTaskRequest.CreateTodoTaskRequestDetailUrl detailUrl = new CreateTodoTaskRequest.CreateTodoTaskRequestDetailUrl
{
AppUrl = appUrl,
PcUrl = pcUrl,
};
CreateTodoTaskRequest createTodoTaskRequest = new CreateTodoTaskRequest
{
OperatorId = creatorId,
SourceId = sourceId,
Subject = subject,
CreatorId = creatorId,
Description = description,
DueTime = dueTime,
ExecutorIds = executorIds?.Split(',').ToList<string>(),
ParticipantIds = participantIds?.Split(',').ToList<string>(),
DetailUrl = detailUrl,
ContentFieldList = new List<CreateTodoTaskRequest.CreateTodoTaskRequestContentFieldList>
{
contentFieldList0
},
IsOnlyShowExecutor = isOnlyShowExecutor,
Priority = priority,
NotifyConfigs = notifyConfigs,
BizCategoryId = "123",
ActionList = new List<CreateTodoTaskRequest.CreateTodoTaskRequestActionList>
{
actionList0
},
};
try
{
CreateTodoTaskResponse res = client.CreateTodoTaskWithOptions(creatorId, createTodoTaskRequest, createTodoTaskHeaders, new AlibabaCloud.TeaUtil.Models.RuntimeOptions());
return res.Body;
}
catch (TeaException err)
{
if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
{
Logger.Error(err.Message);
throw new Exception(err.Message);
}
}
catch (Exception _err)
{
TeaException err = new TeaException(new Dictionary<string, object>
{
{ "message", _err.Message }
});
if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
{
Logger.Error(err.Message);
throw new Exception(err.Message);
}
}
return null;
}
API 找不到。
InvalidApi.NotFound
Specified api is not found, please check your url and method.
404
请检查指定的 action 接口名称是否正确,注意大小写区分。
HttpCode为4xx,调用全阿里云产品的OpenAPI均可能遇到,表示业务错误。一般为请求格式错误、请求方式错误、必填参数丢失、参数格式错误、签名错误、流控限制等问题。此时需查看具体错误码,针对性解决问题。
参考文档https://help.aliyun.com/zh/api-gateway/traditional-api-gateway/support/error-codes
确保您使用的API地址是正确的,没有拼写错误或路径错误。请对照钉钉开放平台文档中关于创建待办事项API的最新地址进行核对
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。