Splunk Search

Unable to pass header using curl command

vik
Explorer

I am trying to hit a URL from splunk using curl command. The end point needs an header to be passed with the key values as "X-User-ID". I am passing the value as below but I still get an error message stating that the value is not passed in the header. Can you help me understand if my query is incorrect. 

| eval header="{\"X-User-ID\": \"myuserid\"}" | curl method=get headerfield=header uri="https://domainname/getstatusData?startTime=2021-07-07%2008:50:00&endTime=2021-07-07%2012:50:00&authe..." debug=true

curl message: "message":"Missing request header \u0027X-User-ID\u0027 for method parameter of type String"

I am able to invoke this from POSTMAN without any issues. 

Tags (2)
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@vik 

I hope you are using this app.

Can you please try this?

| curl headers="{'X-User-ID':'myuserid'}" url="https://domainname/getstatusData?startTime=2021-07-07%2008:50:00&endTime=2021-07-07%2012:50:00&authe..."

 

For more: https://github.com/bmacher/splunk-curl-command

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

 

0 Karma
Get Updates on the Splunk Community!

Splunk App for Anomaly Detection End of Life Announcment

Q: What is happening to the Splunk App for Anomaly Detection?A: Splunk is officially announcing the ...

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...