All Apps and Add-ons

Splunk Add-on Builder REST API - Passing Global Account values to REST URL

ejwade
Contributor

In the Splunk Add-on Builder, I configured a modular input using a REST API to pull data from FortiOS/FortiGate. I am trying to pass global account values (setup parameters), but the recommended variables from the following link do not work when I test the connection:
https://docs.splunk.com/Documentation/AddonBuilder/3.0.1/UserGuide/ConfigureDataCollection#Pass_valu...

Here is the error message:

[ERROR] - [test] HTTPError reason=HTTP Error Unable to find the server at %7b%7bglobal_account.username%7d%7d when sending request to url=https://{{global_account.username}}/api/v2/cmdb/firewall/address?with_meta=true&vdom=*&access_token={{global_account.password}} method=GET

I'm guessing the variable syntax is incorrect, or am I wrong to try and pass the global account values to the URL?

0 Karma

samejgink
Explorer

So I happen to be working with the Zoom API and your link to the documentation helped me out, so I'll use their endpoint API as a reference. Per the documentation they suggest using the namespace, so the URL parameter should have the value ${settings.additional_parameters.param_name}

I'm using JWT for authentication, and have created a Text property in Add-on Setup Paramaters with Global Account Settings checked. This parameter's Internal Name = jwt_token . Yes, adding "token" is redundant... I have also created another Data Input Parameter called Query URL, internal name = query_url

So my REST URL looks like this:
https://api.zoom.us/v2/${query_url}?access_token=${__settings__.additional_parameters.jwt_token}&pag...

In Data Input Parameters I add which API endpoint I will be targeting, in this particular case =users and on the Add-on Setup Parameters tab there will be an "Additional Parameters", and that is where I add my JWT. If you're having problems with the built in Username & Password, I'd suggest building your own parameters for those values. Hope this helps!

0 Karma

laurie_gellatly
Communicator

Looks like the URL is wrong.
I would expect a URL of https://MyFortigate.somewhere/api.... and not the global_account.username

0 Karma

ejwade
Contributor

@laurie_gellatly - thanks for your input. I have since forgone using the global account values, since the variables I need are FortiGate URL and API Token, and don't complete align with username/password.

However, I felt it was interesting that these variable names do not work when passing them to the REST URL (as specified in the documentation). I'm wondering if anyone has found the successful variable names for the global variables.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...