Getting Data In

How do I add a new role via REST API?

davidtrujillo
Explorer

Hi,

How could I add a new role via REST API ?

When I try to send the following HTTP POST via Postman:

URL: https://localhost:8089/services/authorization/roles?name=newrole

Method: POST

Authorization: Basic -credentials-, where -credentials- is
the base64 encoding of ID and password joined by a colon.

I got: Cannot perform action "POST" without a target name to act on.

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <messages>
        <msg type="ERROR">Cannot perform action "POST" without a target name to act on.</msg>
    </messages>
</response>

What does target name refer to? And how could I set the value in order to get the HTTP POST request to work ?

0 Karma

harishmeetsu
Explorer

For anyone facing this issue and still looking for an answer, you need to use url encoded parameters to be passed to the request. The request was successful only after this change was made.

harishmeetsu_0-1650711156316.png

 

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@davidtrujillo - Can you please confirm that this resolves your issue?

If so can you please also accept the answer as solution by clicking on "Accept as Solution" button.

0 Karma

somesoni2
Revered Legend

Have you looked at this? (see the example on POST request)

https://docs.splunk.com/Documentation/Splunk/7.2.4/RESTREF/RESTaccess#authorization.2Froles

0 Karma
Get Updates on the Splunk Community!

Get Schooled with Splunk Education: Explore Our Latest Courses

At Splunk Education, we’re dedicated to providing incredible learning experiences that cater to every skill ...

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL  The Splunk AI Assistant for SPL ...

Buttercup Games: Further Dashboarding Techniques (Part 5)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...