Splunk Search

[SPLUNKD] Not Found for lookup REST api call

sumangala
Path Finder

Hi Splunkers,

I have a curl for changing ownership of lookup file present app level to user level by this curl
curl -k -u admin:password https://localhost:8089/servicesNS/*new user*/*app name*/data/lookup-table-files/lookup_file.csv/acl -d owner=*new user* -d sharing=user

This curl works fine and changes ownership to new user. I have written REST api for this curl in Javascript.
var service = mvc.createService({ owner: form_uid });
var record = {
"owner": form_uid,
"sharing": "user"
};
service.request(
"data/lookup-table-files/lookup_file.csv/acl",
"POST",
null,
null,
JSON.stringify(record),
{"Content-Type": "application/json"},
null).done(function() {
alert("pass");
});

Here form_uid is new user value. After executing this I am getting 404 (Not found) and mvc.js:6 [SPLUNKD] Not Found
With curl I could able to access REST api and result also works. But, with rest api call its not working.
I searched all possible answers from this portal. Can anyone help me to resolve this?

Thank you.

0 Karma
1 Solution

sumangala
Path Finder

A problem is resolved for [SPLUNKD] Not Found error for Splunk rest API access for ACL:
A splunkd endpoint resides on port 8089 by default. In order to access these from code running in Javascript in the context of the browser, it needs to be “expose” setting in $SPLUNK_HOME/etc/system/default/web.conf for below 3 sets of lookup table rest api.

```[expose:data_lookup-table-files]
methods = POST,GET
pattern = data/lookup-table-files

[expose:data_lookup-table-files_ELEMENT]
methods = GET,DELETE,POST
pattern = data/lookup-table-files/*

[expose:data_lookup-table-files_ELEMENT_acl]
methods = POST
pattern = data/lookup-table-files/*/acl
```

View solution in original post

0 Karma

sumangala
Path Finder

A problem is resolved for [SPLUNKD] Not Found error for Splunk rest API access for ACL:
A splunkd endpoint resides on port 8089 by default. In order to access these from code running in Javascript in the context of the browser, it needs to be “expose” setting in $SPLUNK_HOME/etc/system/default/web.conf for below 3 sets of lookup table rest api.

```[expose:data_lookup-table-files]
methods = POST,GET
pattern = data/lookup-table-files

[expose:data_lookup-table-files_ELEMENT]
methods = GET,DELETE,POST
pattern = data/lookup-table-files/*

[expose:data_lookup-table-files_ELEMENT_acl]
methods = POST
pattern = data/lookup-table-files/*/acl
```

0 Karma

jkat54
SplunkTrust
SplunkTrust

You have to add https://localhost:8089/servicesNS/newUser/AppName to the service.request code.

0 Karma

sumangala
Path Finder

In REST api call, if I just mention URL after app name. It generates URL exactly same as curl URL. after executing I can see URL on console is same as curl url. When [SPLUNKD] Not Found error comes?
when required splunk api not present in splunkd. If so it works fine when I run curl.

0 Karma

jkat54
SplunkTrust
SplunkTrust

404 means the URL is invalid, Fix the URL to solve the problem.

Remember that urls are case sensitive too.

0 Karma

sumangala
Path Finder

URL is correct. Its same as curl URL. Curl works. Why not same URL in REST api is giving [SPLUNKD] Not Found?

0 Karma

jkat54
SplunkTrust
SplunkTrust

This:
"data/lookup-table-files/lookup_file.csv/acl"

Is not the same as this:

https://localhost:8089/servicesNS/*new user*/app name/data/lookup-table-files/lookup_file.csv/acl

0 Karma
Get Updates on the Splunk Community!

New This Month in Splunk Observability Cloud - Metrics Usage Analytics, Enhanced K8s ...

The latest enhancements across the Splunk Observability portfolio deliver greater flexibility, better data and ...

Alerting Best Practices: How to Create Good Detectors

At their best, detectors and the alerts they trigger notify teams when applications aren’t performing as ...

Discover Powerful New Features in Splunk Cloud Platform: Enhanced Analytics, ...

Hey Splunky people! We are excited to share the latest updates in Splunk Cloud Platform 9.3.2408. In this ...