Splunk Dev

Call to custom/eai endpoint from setup view

breid1313
Path Finder

Hello all - 

I'm creating a setup view (migrating from setup.xml) for an app and would like to continue to leverage the custom eai python handler that is already in place.

Can anyone point me towards an example of this? I may be using web.conf incorrectly as I can access the handler via port 8089 but when I attempt to call the endpoint from the setup view via the splunkjs sdk it generates a 404 error.

Once I resolve this issue I believe I should be able to pass all the parameters necessary into data: {TODO} in order to use the eai handler the same way we were when using setup.xml

 

app.js

 

 

 

    callScript(){
      $.ajax({
            type: "POST",
            url: "/servicesNS/-/<app_name>/configureMyApp/handleConfig",
            data: {TODO},
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(data) {
                console.log("success returned");
                console.log(data);
            },
            error: function(xhr){
     console.log("Error ", xhr);
         }
      });
    }

 

 

 

 

restmap.conf

 

 

[admin:configureMyApp]
match                 = /configureMyApp
members               = handleConfig        

[admin_external:handleConfig]
handlertype           = python
python.version        = python3
handlerfile           = handler.py
handleractions        = list, edit
handlerpersistentmode = false

 

 

 

web.conf

 

 

[expose:configureMyApp]
methods = GET, POST
pattern = configureMyApp

[expose:handleConfig]
pattern = configureMyApp/*
methods = GET, POST

 

 

Labels (4)
0 Karma

breid1313
Path Finder

My goals could also be accomplished with a [script:] stanza as well. Since we are using a setup view now, all the configuration is done with the splunkjs SDK before the python script is called, so I don't necessarily need an eai endpoint. All I'm looking to do is test a connection to a third-party app using a custom endpoint.

Same question applies here though. I've messed with the examples but get 404's through the js sdk using both a [script:] and [admin:]/[admin_external:] endpoint.

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 ...