Getting Data In

Trying to create an application with Splunk's Restful API

sloaniebaloney
Engager

I'm new to Splunk and am somewhat familiar with REST. I am trying to create a new application through the Splunk RESTful API. The installation is on windows and I am attempting to do this via curl on the command line.

The command I'm typing in is as follows:

curl -u myUsername:myPassword -k https://localhost:8089/services/apps/local/_new/ -d "name=MyApp"

I have also tried this as a non-post with the curl command

curl -u myUsername:myPassword -k https://localhost:8089/services/apps/local/_new/?name=MyApp

The first curl command returns the xml that mimics what is displayed on the splunk services server. The second one throws an error. I have also tried the first one with url-encoding the posted data with -data-urlencode

Any suggestions would be greatly appreciated.

Thanks,

Ken

Tags (1)

ewoo
Splunk Employee
Splunk Employee

What version of Splunk are you using? The following instructions work for 4.1.6.

To create an app, you must provide a name for the new app and a template from which to start:

$ curl -k -u admin:admin -X POST https://localhost:8089/services/apps/local -d 'name=myapp&template=barebones'

This will create an app named 'myapp' based on the barebones template.

In general, '_new' is used to determine what arguments are required to create a new object (or edit an existing one). It is not used to create the objects themselves.

$ curl -u admin:admin -k https://localhost:8089/services/apps/local/_new | xmllint --format -
[snip]
    <s:key name="eai:attributes">
      <s:dict>
        <s:key name="optionalFields">
          <s:list>
            <s:item>author</s:item>
            <s:item>description</s:item>
            <s:item>install</s:item>
            <s:item>label</s:item>
            <s:item>manageable</s:item>
            <s:item>template</s:item>
            <s:item>visible</s:item>
          </s:list>
        </s:key>
        <s:key name="requiredFields">
          <s:list>
            <s:item>name</s:item>
          </s:list>
        </s:key>
        <s:key name="wildcardFields">
          <s:list/>
        </s:key>
      </s:dict> 
    </s:key>
[snip]

sloaniebaloney
Engager

Thank you. This helped an I can now create an application.

Ken

0 Karma
Get Updates on the Splunk Community!

AI for AppInspect

We’re excited to announce two new updates to AppInspect designed to save you time and make the app approval ...

App Platform's 2025 Year in Review: A Year of Innovation, Growth, and Community

As we step into 2026, it’s the perfect moment to reflect on what an extraordinary year 2025 was for the Splunk ...

Operationalizing Entity Risk Score with Enterprise Security 8.3+

Overview Enterprise Security 8.3 introduces a powerful new feature called “Entity Risk Scoring” (ERS) for ...