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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...