Getting Data In

unable to pass URL using curl command

anooshac
Communicator

Hi all,

I am passing some data in JSON format to Splunk using curl. When i try to pass the URL it gives an error " nested brace in URL position 19". Not getting where went wrong even though all the braces are proper. Can anyone help me in this?

Labels (2)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Well, something must be wrong if you're getting an error. We can't know what it is without more details about your curl invocation.

0 Karma

anooshac
Communicator

I am using the following to add data. I am not supposed to share the data here so i have given one example.

curl https://aa-abc-abcd-data-abc.com:1234/abc/abc/raw -H "Authorization: Splunk abc-hwhuhw1-dshjhsj-whdedg" -d {\"DATA_SET\":{\"NUMBER\":\"75\",\"TASK_URL\":\"https://abc.com/xyz/task/abcabc/\",\"DATA_URL\":\"https://abc.com/xyz/source/dataName/com.abc.team.data.DATA/\",\"PARTS\":[\"NAME\":\"abc.abc.abc\",\"SUB\":\"12345-\"]}}

The URL has some issue.

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Of course I didn't expect full raw data due to privacy issues 🙂

If you're typing this into shell, remember that you're hitting shell's expansion first.

See for yourself

$ echo {\"DATA_SET\":{\"NUMBER\":\"75\",\"TASK_URL\":\"https://abc.com/xyz/task/abcabc/\",\"DATA_URL\":\"https://abc.com/xyz/source/dataName/com.abc.team.data.DATA/\",\"PARTS\":[\"NAME\":\"abc.abc.abc\",\"SUB\":\"12345-\"]}}
{"DATA_SET":"NUMBER":"75"} {"DATA_SET":"TASK_URL":"https://abc.com/xyz/task/abcabc/"} {"DATA_SET":"DATA_URL":"https://abc.com/xyz/source/dataName/com.abc.team.data.DATA/"} {"DATA_SET":"PARTS":["NAME":"abc.abc.abc"} {"DATA_SET":"SUB":"12345-"]}

 That's probably not what you want.

You should at least surround whole parameter to -d with quotes.

And next time, try curl with -v to easier see whether the issue is with the curl invocation syntax and curl won't even try to connect to the server in the first place or is it with the parameters/data syntax so that the error is returned by the server.

0 Karma

anooshac
Communicator

I removed DATA_SET. Tried executing with -v and it says {"text":"The requested URL was not found on this server.","code":404}. I guess it searching for the URL in the server mentioned in curl command.

0 Karma
Get Updates on the Splunk Community!

From Alert to Resolution: How Splunk Observability Helps SREs Navigate Critical ...

It's 3:17 AM, and your phone buzzes with an urgent alert. Wire transfer processing times have spiked, and ...

ATTENTION!! We’re MOVING (not really)

Hey, all! In an effort to keep this Slack workspace secure and also to make our new members' experience easy, ...

Splunk Admins: Build a Smarter Stack with These Must-See .conf25 Sessions

  Whether you're running a complex Splunk deployment or just getting your bearings as a new admin, .conf25 ...