All Apps and Add-ons

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

Communicator

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

Engager

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

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

Communicator

@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
Don’t Miss Global Splunk
User Groups Week!

Free LIVE events worldwide 2/8-2/12
Connect, learn, and collect rad prizes
and swag!