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!

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...