Dashboards & Visualizations

How to add token input to setup.xml?

sergiyyarinovsk
Explorer

Hi.

I want to create small app for Splunk Enterprise which gets data from a third part API, using a token. That means the customer should be able to input the token for this app. I use setup.xml to have the ability to save customer data. Tried this solution from docs:
http://docs.splunk.com/Documentation/Splunk/4.3.1/Developer/SetupExampleCustom , but it doesn't work. Also I've used this solution https://answers.splunk.com/answers/105339/how-do-i-allow-users-to-edit-credentials-using-the-setup-s...

<setup>
   <block title="Thread Bare Credential" endpoint="storage/passwords" entity="tedward*" mode="iter" eai_strict="false">
     <input field="password">
       <label>Password for $username$</label>
       <type>password</type>
     </input>
   </block>
  </setup>

But I don't know how to create credentials for the first time because Wplunk requires existing creds for tedward. Any suggestion what can I do? Maybe some other way than setup.xml

Thanks

0 Karma
1 Solution

sergiyyarinovsk
Explorer

Ok. So solution for now is:

setup.xml:

<setup>
  <block title="" endpoint="admin/conf-inputs" entity="API token">
    <input field="token">
      <label>API token</label>
      <type>text</type>
    </input>
  </block>
</setup>

myapp/default/inputs.conf:

 ...
[API token]
token =

As result:
myapp/local/inputs.conf:

[API token]
disabled = 0
token = 937-99-92

Looks like it does what I need, so I stop on this one.

View solution in original post

0 Karma

sergiyyarinovsk
Explorer

Ok. So solution for now is:

setup.xml:

<setup>
  <block title="" endpoint="admin/conf-inputs" entity="API token">
    <input field="token">
      <label>API token</label>
      <type>text</type>
    </input>
  </block>
</setup>

myapp/default/inputs.conf:

 ...
[API token]
token =

As result:
myapp/local/inputs.conf:

[API token]
disabled = 0
token = 937-99-92

Looks like it does what I need, so I stop on this one.

0 Karma

ChrisG
Splunk Employee
Splunk Employee

What version of Splunk Enterprise are you using? Your doc link is from 4.3, which has reached end of life.

0 Karma

sergiyyarinovsk
Explorer

I am using 6.3. But docs are identical for both versions: http://docs.splunk.com/Documentation/Splunk/6.3.0/AdvancedDev/SetupExampleCustom
Weird that it does not work from doc 😞 And error is:

2015-10-15 12:15:31,508 DEBUG   [561f6eb2f1107002f90] _cplogging:55 - [15/Oct/2015:12:15:31] HTTP Traceback (most recent call last):
  File "/Applications/Splunk/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 606, in respond
    cherrypy.response.body = self.handler()
  File "/Applications/Splunk/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 25, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/Applications/Splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/lib/routes.py", line 366, in default
    return route.target(self, **kw)
  File "<string>", line 1, in <lambda>
  File "/Applications/Splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/lib/decorators.py", line 38, in rundecs
    return fn(*a, **kw)
  File "<string>", line 1, in <lambda>
  File "/Applications/Splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/lib/decorators.py", line 118, in check
    return fn(self, *a, **kw)
  File "<string>", line 1, in <lambda>
  File "/Applications/Splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/lib/decorators.py", line 167, in validate_ip
    return fn(self, *a, **kw)
  File "<string>", line 1, in <lambda>
  File "/Applications/Splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/lib/decorators.py", line 335, in preform_sso_check
    return fn(self, *a, **kw)
  File "<string>", line 1, in <lambda>
  File "/Applications/Splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/lib/decorators.py", line 387, in check_login
    return fn(self, *a, **kw)
  File "<string>", line 1, in <lambda>
  File "/Applications/Splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/lib/decorators.py", line 407, in handle_exceptions
    return fn(self, *a, **kw)
  File "<string>", line 1, in <lambda>
  File "/Applications/Splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/lib/decorators.py", line 462, in apply_cache_headers
    response = fn(self, *a, **kw)
  File "/Applications/Splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/controllers/admin.py", line 1567, in listEntities
    self.flattenElements(uiHelper['elements'], uiHelper_elements)
KeyError: 'elements'
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...