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.
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
```
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
```
You have to add https://localhost:8089/servicesNS/newUser/AppName to the service.request code.
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.
404 means the URL is invalid, Fix the URL to solve the problem.
Remember that urls are case sensitive too.
URL is correct. Its same as curl URL. Curl works. Why not same URL in REST api is giving [SPLUNKD] Not Found
?
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