Resolve %22 as %22 not quote

I am trying to build one statement for API call, where I need %22 as %22 but its getting replaced with " quotes

concatenation "Text %22," of (it & "%22") of lines of file "C:\Temp\Text.txt"

How I can handle that so that it should be printed as %22 only.

Not sure I have understood correctly, but I think:

concatenation "Text %2522," of (it & "%2522") of lines of file "C:\Temp\Text.txt"

1 Like

Thanks @trn, we are getting closer :slight_smile: but its giving me extra %2522 , desired output be “text %22” but with my relevance I am getting "text ", however after adding %25 getting “Text %2522”,

Is this in the debugger?

It does have an option in preferences to percent encode, but clearing that hasn’t helped :frowning:

image

As of now, yes but once its done I will be mapping this into action script to fill up info under one parameter & than, parameter values will be pasted into cURL based API query.

After adding %2522, although its showing %2522 but when its being used during API call its getting converted into %22 not as quotes due to that query is failing. so if I somehow able to manage or print only %22 at 1st place my query will work.

Below output is from output.xml file if %2522 is being passed-

<Query Resource="ids of bes computers whose ((rope %22,%22 &amp; rope %22,Server1%22 &amp; rope %22,Server2%22 &amp; rope %22,Server3%22 &amp; rope %22,Server4%22 &amp; rope %22,Server5%22 &amp; rope %22,%22) contains (%22,%22&amp; name of it as lowercase &amp;%22,%22))">
		<Result></Result>
		<Error>This expression contained a character which is not allowed.</Error>

Below output is when only %22 is being passed -

<Query Resource="ids of bes computers whose ((rope &quot;,&quot; &amp; rope &quot;,Server1&quot; &amp; rope &quot;,Server2&quot; &amp; rope &quot;,Server3&quot; &amp; rope &quot;,Server4&quot; &amp; rope &quot;,Server5&quot; &amp; rope &quot;,&quot;) contains (&quot;,&quot;&amp; name of it as lowercase &amp;&quot;,&quot;))">
		<Result>
			<Answer type="integer">4267590</Answer>
			<Answer type="integer">6346207</Answer>

@vk.khurava Could you open a ticket at support.bigfix.com for this issue, please?

1 Like

There is a workaround at SOLVED: How do I get a DoubleQuote in a session relevance result using the rest api that may be useful. Solution from @brolly33 in fact :slight_smile:

It seems to be an effect of going through multiple levels of encoding – both URL-encoding and Relevance encoding; depending on your REST client you may have the tool itself perform some url-encoding for you, such as the --data-urlencode option on Curl.

From @brolly33’s posting (which will not ‘quote’ properly here, because…some of it gets percent-encoded :slight_smile: ). Note the use of %252522. URL-decoding represents that as %2522 and then Relevance decoding represents as %22, the " symbol.


Because of the decoding happening in multiple steps, you need to percent encode the percent to get around this.

session relevance
"%22"

rest query
https://brollytest:52311/api/query?relevance=(%22%252522%22)

on the first decode pass,
the outer %22 turns into "
the outer %25 turns into %

Then on the second decode pass you effectively have "%2522" which converts to a "%22" and finally to a """
2 Likes

Thanks @JasonWalker @brolly33 ! @trn I believe given the same solution in his post.

but the problem is my relevance query is not getting resolved properly using %2522.

relevance="ids of bes computers whose ((rope %2522,%2522 & rope %2522,Server1%2522 & rope %2522,Server2%2522 & rope %2522,Server3%2522 & rope %2522,Server4%2522 & rope %2522,5%2522 & rope %2522,%2522) contains (%2522,%2522 & name of it as lowercase & %2522,%2522))"

Query output -

<Query Resource="ids of bes computers whose ((rope %22,%22 &amp; rope %22,Server1%22 &amp; rope %22,Server2%22 &amp; rope %22,Server3%22 &amp; rope %22,Server4%22 &amp; rope %22,Server5%22 &amp; rope %22,%22) contains (%22,%22&amp; name of it as lowercase &amp;%22,%22))">
		<Result></Result>
		<Error>This expression contained a character which is not allowed.</Error>

@JasonWalker There is a tipping point in life where what you have forgotten outweighs what you still know.
Thanks for the reminder!

@vk.khurava

It’s an extra pass in Query. %252522

In pure relevance   "%22"   >>  """
In most API calls single wrap    "%2522"  >>  "%22"   >>  """
in API to Query you have to double wrap    "%252522"  >>  "%2522"  >>  "%22"  >>  """

Try:

relevance="ids of bes computers whose ((rope %252522,%252522 & rope %252522,Server1%252522 & rope %252522,Server2%252522 & rope %252522,Server3%252522 & rope %252522,Server4%252522 & rope %252522,5%252522 & rope %252522,%252522) contains (%252522,%252522 & name of it as lowercase & %252522,%252522))"

4 Likes

Many Thanks worked like charm :slight_smile:

1 Like