Httpbinding special characters

Hi,

I’m new to openHAB. I would like to make the following http request using the httpbinding but it does not appear to work:
http://10.0.0.251:5984/dev_home_data_v2/_design/views/_view/get_latest_temp_humid_by_iot_id?startkey=[“ESP0007”]&endkey=[“ESP0007”,{}]

I suspect it is due to the square brackets and curly braces. Is there a way to escape these special characters?

Thanks for your help in advance!

Yes. Here is a link to the full map. You will want:

  • [ = %5B
  • ] = %5D
  • { = %7B
  • } = %7D

Try this: http://www.url-encode-decode.com/

Thanks for the help! Not only did I need to escape the braces, I also then had to escape the percentage symbol because the httpbinding is expecting a parameter. Here is the final working escaped url for anyone that runs into this:
http://10.0.0.251:5984/dev_home_data_v2/_design/views/_view/get_latest_temp_humid_by_iot_id?startkey=%[%"ESP0007%"%]&endkey=%[%"ESP0007%",%{%}%]

Does this also apply to REGEX?

I would like to extract “plugged” from curl:
The result of curl looks like this:

Battery level 47% (plugged)

I tried:
val String plugged = transform(“REGEX”, “.% %%28(…).”, json) - ascii replacement for (
val String plugged = transform(“REGEX”, “.% ((…).”, json) - escaping (
val String plugged = transform(“REGEX”, “.%%25%%20%%28(…).”, json)

none of these work.

So how to look for “% (” and extract the next 7 characters?

EDIT:
Got it:
I needed to double escape the “(”
val String plugged = transform("REGEX", ".*% \\((.......).*", json)