<?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 get_global_setting returns api_key as &amp;quot;undefined&amp;quot; in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/get-global-setting-returns-api-key-as-quot-undefined-quot/m-p/525794#M88741</link>
    <description>&lt;P&gt;I have made a Tech add on that polls an API. In order to perform requests against the API, an API key is required.&lt;/P&gt;&lt;P&gt;I have used the following as the example in order to get the URL and the API key for the request saved onto Splunk:&lt;BR /&gt;&lt;A href="https://github.com/splunk/Developer_Guidance_Setup_View_Example" target="_blank" rel="noopener"&gt;https://github.com/splunk/Developer_Guidance_Setup_View_Example&lt;/A&gt;&lt;/P&gt;&lt;P&gt;When I look at the app specific conf files ( ie /opt/splunk/etc/apps/TA-eg/local/ta_eg_settings.conf)&lt;BR /&gt;&lt;BR /&gt;Then I see that the api_key is starred out, ie encrypted at rest:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[additional_parameters]
api_key = ********
eg_domain = &amp;lt;correct_plaintext_domain&amp;gt;
disabled = 0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However if I attempt to use the python helper function&amp;nbsp;&lt;STRONG&gt;get_global_setting(&lt;/STRONG&gt;&lt;I&gt;"api_key"&lt;/I&gt;&lt;STRONG&gt;)&amp;nbsp;&lt;/STRONG&gt;as defined in:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/AddonBuilder/3.0.2/UserGuide/PythonHelperFunctions" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/AddonBuilder/3.0.2/UserGuide/PythonHelperFunctions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Then it is always returning the string "undefined" as opposed to the correct API key that I added.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In&amp;nbsp;&lt;I&gt;&lt;SPAN&gt;TA-eg/bin/TA_eg_rh_settings.py&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/I&gt;I have also set encrypted = True for the correct field:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;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, 
        )
    )
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me figure out how to get the correct output using the Splunk helper functions.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Oct 2020 13:41:12 GMT</pubDate>
    <dc:creator>KeaganJ</dc:creator>
    <dc:date>2020-10-21T13:41:12Z</dc:date>
    <item>
      <title>get_global_setting returns api_key as "undefined"</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/get-global-setting-returns-api-key-as-quot-undefined-quot/m-p/525794#M88741</link>
      <description>&lt;P&gt;I have made a Tech add on that polls an API. In order to perform requests against the API, an API key is required.&lt;/P&gt;&lt;P&gt;I have used the following as the example in order to get the URL and the API key for the request saved onto Splunk:&lt;BR /&gt;&lt;A href="https://github.com/splunk/Developer_Guidance_Setup_View_Example" target="_blank" rel="noopener"&gt;https://github.com/splunk/Developer_Guidance_Setup_View_Example&lt;/A&gt;&lt;/P&gt;&lt;P&gt;When I look at the app specific conf files ( ie /opt/splunk/etc/apps/TA-eg/local/ta_eg_settings.conf)&lt;BR /&gt;&lt;BR /&gt;Then I see that the api_key is starred out, ie encrypted at rest:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[additional_parameters]
api_key = ********
eg_domain = &amp;lt;correct_plaintext_domain&amp;gt;
disabled = 0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However if I attempt to use the python helper function&amp;nbsp;&lt;STRONG&gt;get_global_setting(&lt;/STRONG&gt;&lt;I&gt;"api_key"&lt;/I&gt;&lt;STRONG&gt;)&amp;nbsp;&lt;/STRONG&gt;as defined in:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/AddonBuilder/3.0.2/UserGuide/PythonHelperFunctions" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/AddonBuilder/3.0.2/UserGuide/PythonHelperFunctions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Then it is always returning the string "undefined" as opposed to the correct API key that I added.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In&amp;nbsp;&lt;I&gt;&lt;SPAN&gt;TA-eg/bin/TA_eg_rh_settings.py&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/I&gt;I have also set encrypted = True for the correct field:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;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, 
        )
    )
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me figure out how to get the correct output using the Splunk helper functions.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 13:41:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/get-global-setting-returns-api-key-as-quot-undefined-quot/m-p/525794#M88741</guid>
      <dc:creator>KeaganJ</dc:creator>
      <dc:date>2020-10-21T13:41:12Z</dc:date>
    </item>
  </channel>
</rss>

