<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Splunk REST API Post route is throwing Cannot perform action &amp;quot;POST&amp;quot; without a target name to act on .net core in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-REST-API-Post-route-is-throwing-Cannot-perform-action/m-p/592212#M12088</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I am trying to create a role using splunk REST API (&lt;/SPAN&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.5/RESTREF/RESTaccess#authorization.2Froles" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.5/RESTREF/RESTaccess#authorization.2Froles&lt;/A&gt;&lt;SPAN&gt;). 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.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;using&lt;/SPAN&gt; (&lt;SPAN class=""&gt;var&lt;/SPAN&gt; client = _serviceClientFactory.GetServiceClient()) &lt;SPAN class=""&gt;//client service factory returns a ServiceClient&lt;/SPAN&gt;
                {
                    PostRoleRequest request = &lt;SPAN class=""&gt;new&lt;/SPAN&gt; PostRoleRequest
                    {
                        name = Const.DefaultRoleName &lt;SPAN class=""&gt;//this is the only required param&lt;/SPAN&gt;
                    };
                    
                    &lt;SPAN class=""&gt;var&lt;/SPAN&gt; response = &lt;SPAN class=""&gt;await&lt;/SPAN&gt; client.PostAsync&amp;lt;PostRoleResponse&amp;gt;(&lt;SPAN class=""&gt;$"/services/authorization/roles?output_mode=json"&lt;/SPAN&gt;, request);
                }

 &lt;SPAN class=""&gt;public&lt;/SPAN&gt; &lt;SPAN class=""&gt;class&lt;/SPAN&gt; &lt;SPAN class=""&gt;PostRoleRequest&lt;/SPAN&gt;
    {
        &lt;SPAN class=""&gt;public&lt;/SPAN&gt; &lt;SPAN class=""&gt;string&lt;/SPAN&gt; name { &lt;SPAN class=""&gt;get&lt;/SPAN&gt;; &lt;SPAN class=""&gt;set&lt;/SPAN&gt;; }
    }&lt;BR /&gt;&lt;BR /&gt;public class PostRoleResponse&lt;BR /&gt;{&lt;BR /&gt;public Entry entry { get; set; }&lt;BR /&gt;&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public class Entry&lt;BR /&gt;{&lt;BR /&gt;public string name { get; set; }&lt;BR /&gt;public string id { get; set; }&lt;/P&gt;&lt;P&gt;public DateTime updated { get; set; }&lt;BR /&gt;public List&amp;lt;string&amp;gt; links { get; set; }&lt;BR /&gt;public string author { get; set; }&lt;BR /&gt;public Acl acl { get; set; }&lt;BR /&gt;public Content content { get; set; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Mon, 04 Apr 2022 13:00:32 GMT</pubDate>
    <dc:creator>mylarehman</dc:creator>
    <dc:date>2022-04-04T13:00:32Z</dc:date>
    <item>
      <title>Splunk REST API Post route is throwing Cannot perform action "POST" without a target name to act on .net core</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-REST-API-Post-route-is-throwing-Cannot-perform-action/m-p/592212#M12088</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am trying to create a role using splunk REST API (&lt;/SPAN&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.5/RESTREF/RESTaccess#authorization.2Froles" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.5/RESTREF/RESTaccess#authorization.2Froles&lt;/A&gt;&lt;SPAN&gt;). 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.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;using&lt;/SPAN&gt; (&lt;SPAN class=""&gt;var&lt;/SPAN&gt; client = _serviceClientFactory.GetServiceClient()) &lt;SPAN class=""&gt;//client service factory returns a ServiceClient&lt;/SPAN&gt;
                {
                    PostRoleRequest request = &lt;SPAN class=""&gt;new&lt;/SPAN&gt; PostRoleRequest
                    {
                        name = Const.DefaultRoleName &lt;SPAN class=""&gt;//this is the only required param&lt;/SPAN&gt;
                    };
                    
                    &lt;SPAN class=""&gt;var&lt;/SPAN&gt; response = &lt;SPAN class=""&gt;await&lt;/SPAN&gt; client.PostAsync&amp;lt;PostRoleResponse&amp;gt;(&lt;SPAN class=""&gt;$"/services/authorization/roles?output_mode=json"&lt;/SPAN&gt;, request);
                }

 &lt;SPAN class=""&gt;public&lt;/SPAN&gt; &lt;SPAN class=""&gt;class&lt;/SPAN&gt; &lt;SPAN class=""&gt;PostRoleRequest&lt;/SPAN&gt;
    {
        &lt;SPAN class=""&gt;public&lt;/SPAN&gt; &lt;SPAN class=""&gt;string&lt;/SPAN&gt; name { &lt;SPAN class=""&gt;get&lt;/SPAN&gt;; &lt;SPAN class=""&gt;set&lt;/SPAN&gt;; }
    }&lt;BR /&gt;&lt;BR /&gt;public class PostRoleResponse&lt;BR /&gt;{&lt;BR /&gt;public Entry entry { get; set; }&lt;BR /&gt;&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public class Entry&lt;BR /&gt;{&lt;BR /&gt;public string name { get; set; }&lt;BR /&gt;public string id { get; set; }&lt;/P&gt;&lt;P&gt;public DateTime updated { get; set; }&lt;BR /&gt;public List&amp;lt;string&amp;gt; links { get; set; }&lt;BR /&gt;public string author { get; set; }&lt;BR /&gt;public Acl acl { get; set; }&lt;BR /&gt;public Content content { get; set; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 13:00:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-REST-API-Post-route-is-throwing-Cannot-perform-action/m-p/592212#M12088</guid>
      <dc:creator>mylarehman</dc:creator>
      <dc:date>2022-04-04T13:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk REST API Post route is throwing Cannot perform action "POST" without a target name to act on .net c</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-REST-API-Post-route-is-throwing-Cannot-perform-action/m-p/592238#M12091</link>
      <description>&lt;P&gt;Looks like I have figured what the problem is. If I send a text/html request header format and send the request in text format, the post route works. However, I am really confused as to why the Rest Api doesn't accept json format? Any ideas? What am I missing?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 15:19:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-REST-API-Post-route-is-throwing-Cannot-perform-action/m-p/592238#M12091</guid>
      <dc:creator>mylarehman</dc:creator>
      <dc:date>2022-04-04T15:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk REST API Post route is throwing Cannot perform action "POST" without a target name to act on .net c</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-REST-API-Post-route-is-throwing-Cannot-perform-action/m-p/656178#M17243</link>
      <description>&lt;P&gt;hi, I am facing same issue. did you end up fixing it?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 02:40:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-REST-API-Post-route-is-throwing-Cannot-perform-action/m-p/656178#M17243</guid>
      <dc:creator>damode1</dc:creator>
      <dc:date>2023-08-31T02:40:19Z</dc:date>
    </item>
  </channel>
</rss>

