All Apps and Add-ons

curl command not working may be a format issue - webtools addon

ansif
Motivator

Unable to run curl from Splunk search.

Working fine from ssh session:

 

-bash-4.2$ curl -k -u admin:xxxxxxx https://localhost:8089/servicesNS/nobody/SA-ITOA/maintenance_services_interface/maintenance_calendar -X POST -H "Content-Type:application/json" -d '{"title":"TEST MW","start_time":"1591814852.152","end_time":"1592814852.364","objects": [{"object_type": "entity", "_key": "e7002b20-6b38-49ec-ad2a-29a0be0d2d65"}]}'

{"_key": "5ee1d57e5575d4d6ee5710d1"}


But below search throws error:

 

index=_internal
| head 1
| eval header="{\"content-type\":\"application/json\"}"
| eval data="{\"title\":\"TEST MW\",\"start_time\":\"1591814852.152\",\"end_time\":\"1592814852.364\",\"objects\":[{\"object_type\":\"entity\",\"_key\":\"e7002b20-6b38-49ec-ad2a-29a0be0d2d65\"}]}"
| curl method=post uri=https://localhost:8089/servicesNS/nobody/SA-ITOA/maintenance_services_interface/maintenance_calendar splunkauth=true debug=true headerfield=header datafield=data

 

Please help.

Labels (2)
0 Karma

jkat54
SplunkTrust
SplunkTrust

have you tried to URLENCODE your message?

have you tried validating your json?

The error is saying that the fields are improperly defined.  Most likely due to bad encoding or escaping.

0 Karma
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 ...