Splunk Dev

Rest Api not allowing special character

luist
Engager

Hi,

I am using the Splunk API 8.1.1 and using a script to UPDATE an existing dashboard. When i try to send these characters ; & > < i got an error 400 bad request saying "...is not supported by this handler".

curl --location --request POST 'https://localhost:8089/servicesNS/nobody/myapp/data/ui/views/mydashboard' \
--header 'Authorization: Basic YWRtaW46cGFzc3dvcmQ=' \
--header 'Content-Type: text/html' \
--data-raw 'eai:data=<dashboard><label>My Report</label><description>My characters are: ; & > < and more...</description></dashboard>'

How can I send these characters so I can display them on my dashboard?

Thanks in advance!

Labels (3)
0 Karma
1 Solution

luist
Engager

I found the way to send this characters by encoding to XML-ENCODE and then do a URL-ENCODED:

So the first step is to encode this characters to xml-encode:

After:   ; & > < 
Before:    ; &amp; &gt; &lt;

And then encode to url-encode:

After:   ; &amp; &gt; &lt;
Before:    %3B %26amp%3B% 26gt%3B% 26lt%3B

 In the end I have to send this message:

'eai:data=<dashboard><label>My Report</label><description>My characters are: %3B %26amp%3B% 26gt%3B% 26lt%3B and more...</description></dashboard>'

 

View solution in original post

luist
Engager

I found the way to send this characters by encoding to XML-ENCODE and then do a URL-ENCODED:

So the first step is to encode this characters to xml-encode:

After:   ; & > < 
Before:    ; &amp; &gt; &lt;

And then encode to url-encode:

After:   ; &amp; &gt; &lt;
Before:    %3B %26amp%3B% 26gt%3B% 26lt%3B

 In the end I have to send this message:

'eai:data=<dashboard><label>My Report</label><description>My characters are: %3B %26amp%3B% 26gt%3B% 26lt%3B and more...</description></dashboard>'

 

richgalloway
SplunkTrust
SplunkTrust

Send the characters HTML-encoded (&gt;, etc.).

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

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

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...