All Apps and Add-ons

TA-Webtools - Why am I getting the error CURL invalid json in request?

glouka_tp
Loves-to-Learn Everything

Hello,

I'm trying to run the following:

 

| makeresults count=1

| eval data = "{\"something\":\"something\",\"something\":\"something\",\"something\":\"something\"}"

| eval header = "{\"header-api-key\":\"something\"}"

| curl  method=post  uri="https://api.something/v2" headerfield=header  data=data debug=t verifyssl=false

| table  *

 

and I'm getting

"{"status": "error", "result": "Invalid json format in the request".

Also I tried to add

"{\"content-type\":\"application/json\"}" like :

 

| eval header = "{"{\"content-type\":\"application/json\"}",\"header-api-key\":\"something\"}"

 

but I get the some error. Note that I have the latest version of TA-webtools

Anyone has any suggestions? 

Thank in advance 

Labels (1)
Tags (4)
0 Karma

gjanders
SplunkTrust
SplunkTrust

Try datafield=data

 

| curl  method=post  uri="https://api.something/v2" headerfield=header  datafield=data debug=t verifyssl=false

 

0 Karma

glouka_tp
Loves-to-Learn Everything

Same error as before

0 Karma

gjanders
SplunkTrust
SplunkTrust

I've used nearly identical settings and it works.

 

If you hit same endpoint using the actual curl CLI tool do you see the same issue?

0 Karma

glouka_tp
Loves-to-Learn Everything

Thank for your reply gjanders.

I don't have any error with the actual curl. The response is in a json format.

Find below the actual curl:

curl -X POST -d @option.txt -k -H "header-api-key:<API KEY>" "https://api.something/v2"

 

option.txt file:

{

"something": "something",

"something": "something",

"something": "something"

}

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk Cloud Platform 9.1.2308?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2308! Analysts can ...

Index This | Why do they call it hyper text?

November 2023 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

State of Splunk Careers 2023: Career Resilience and the Continued Value of Splunk

For the past three years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...