Splunk REST API POST路线投掷无法执行行动。没有目标名称可以对.NET核心作用

发布于 2025-01-18 23:47:33 字数 1056 浏览 0 评论 0原文

我正在尝试使用Splunk Rest API(“ noreferrer”> https://docs.splunk.com/documentation/splunk/8.2.5/restref/restaccess#authorization.2froles )。该路线使用Postman完美地工作,但是当我尝试使用.NET Core使用IservClient进行相同的路线时,我会在没有目标名称上行动的“无法执行操作”。请让我知道我还能提供哪些信息。一直在Google上搜索错误和Splunk文档中,没有运气。

using (var client = _serviceClientFactory.GetServiceClient()) //client service factory returns a ServiceClient
                {
                    PostRoleRequest request = new PostRoleRequest
                    {
                        name = Const.DefaultRoleName //this is the only required param
                    };
                    
                    var response = await client.PostAsync<PostRoleResponse>($"/services/authorization/roles?output_mode=json", request);
                }

 public class PostRoleRequest
    {
        public string name { get; set; }
    }

I am trying to create a role using splunk REST API (https://docs.splunk.com/Documentation/Splunk/8.2.5/RESTREF/RESTaccess#authorization.2Froles). The route works perfectly using postman, but when I try to invoke the same route using IServiceClient via .net core, I run in to "Cannot perform action "POST" without a target name to act on". Please let me know what other information I can provide. Have been searching on google for the error and in splunk documentation with no luck.

using (var client = _serviceClientFactory.GetServiceClient()) //client service factory returns a ServiceClient
                {
                    PostRoleRequest request = new PostRoleRequest
                    {
                        name = Const.DefaultRoleName //this is the only required param
                    };
                    
                    var response = await client.PostAsync<PostRoleResponse>(
quot;/services/authorization/roles?output_mode=json", request);
                }

 public class PostRoleRequest
    {
        public string name { get; set; }
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文