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!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...