Splunk Search

Why using semicolon as multivalue delimiter results in "Unbalanced quotes" error when using the API?

rjdefrancisco
Explorer

The following works fine in the Search app:

 

... | makemv delim=";" hashes | ...

 

The equivalent curl call

 

curl ... -d search="search ... | makemv delim=\";\" hashes | ..." -d output_mode=csv

 

fails with an "Unbalanced quotes" error. 

Delimiters other than ; work fine. I tried to escape the semicolon, use Unicode values, replace the string with a variable, all to no avail. Any suggestions?

Labels (2)
0 Karma
1 Solution

rjdefrancisco
Explorer

I finally solved the problem by replacing the semicolon  with its URL encoding (%3b) inside the curl command:

curl ... -d search="search ... | makemv delim=\"%3b\" hashes | ..." -d output_mode=csv

 

View solution in original post

rjdefrancisco
Explorer

I finally solved the problem by replacing the semicolon  with its URL encoding (%3b) inside the curl command:

curl ... -d search="search ... | makemv delim=\"%3b\" hashes | ..." -d output_mode=csv

 

richgalloway
SplunkTrust
SplunkTrust

How are you escaping the semicolon in the curl command?  I suspect you need to use a shell escape to keep the shell from thinking the ; separates two commands (and makes Splunk think the search is missing a quote).

curl ... -d search="search ... | makemv delim=\"~;\" hashes | ..." -d output_mode=csv
---
If this reply helps you, Karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...