Getting Data In

Who can tell me why the API POST for JSON doc times out -

himynamesdave
Contributor

This DOES NOT work:

curl -k -u admin:changeme "https://0.0.0.0:8089/services/receivers/simple?source=mysource&index=myindex" -d {"somefield":"foobar”}

This DOES work:

curl -k -u admin:changeme "https://0.0.0.0:8089/services/receivers/simple?source=mysource&index=myindex" -d somefield=foobar

Looking at the docs (http://dev.splunk.com/view/SP-CAAADQT), I think this is hinting at why the first request is broken "The -d/--post-data arguments for curl/wget need to be url-encoded, should they have characters needing escaping."

Can someone tell me how a JSON data should be formatted to be submitted like this? Thanks!

Tags (3)
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Sounds like a curl/shell issue to me. curl -d "string" means you want something like this:

curl ... -d "foo bar"

As a result, I'd guess passing JSON might look like this (untested):

curl ... -d "{\"somefield\":\"foobar\"}"

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

Sounds like a curl/shell issue to me. curl -d "string" means you want something like this:

curl ... -d "foo bar"

As a result, I'd guess passing JSON might look like this (untested):

curl ... -d "{\"somefield\":\"foobar\"}"
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...