Getting Data In

get_global_setting returns api_key as "undefined"

KeaganJ
Path Finder

I have made a Tech add on that polls an API. In order to perform requests against the API, an API key is required.

I have used the following as the example in order to get the URL and the API key for the request saved onto Splunk:
https://github.com/splunk/Developer_Guidance_Setup_View_Example

When I look at the app specific conf files ( ie /opt/splunk/etc/apps/TA-eg/local/ta_eg_settings.conf)

Then I see that the api_key is starred out, ie encrypted at rest:

 

 

 

[additional_parameters]
api_key = ********
eg_domain = <correct_plaintext_domain>
disabled = 0

 

 

 

However if I attempt to use the python helper function get_global_setting("api_key"as defined in:

https://docs.splunk.com/Documentation/AddonBuilder/3.0.2/UserGuide/PythonHelperFunctions

Then it is always returning the string "undefined" as opposed to the correct API key that I added.

 

In TA-eg/bin/TA_eg_rh_settings.py  I have also set encrypted = True for the correct field:

 

 

 

fields_additional_parameters = [
    field.RestField(
        'eg_domain',
        required=True,
        encrypted=False,
        default='',
        validator=validator.String(
            min_len=0, 
            max_len=8192, 
        )
    ), 
    field.RestField(
        'api_key',
        required=True,
        encrypted=True,
        default='',
        validator=validator.String(
            min_len=0, 
            max_len=8192, 
        )
    )
]

 

 

 

 

Please help me figure out how to get the correct output using the Splunk helper functions.

Labels (1)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...