I'm trying to do a REST query with the following query parameters:
$select=id
$expand=is_running__release($select=id)
$format=json;metadata=none
It works fine on the command-line:
curl -H "Authorization: Bearer ..." \
'https://api.balena-cloud.com/v6/device?$select=id&$expand=is_running__release($select=id)&$format=json;metadata=none'
Unfortunately for me, Retool insists on percent-encoding those $
and =
characters in values of the query parameter, producing the following error from the server:
"message": "Malformed url: '/resin/device?$expand=is_running__release(%24select%3Did)&$format=json%3Bmetadata%3Dnone&$select=id'"
I just spent a good part of my afternoon debugging this and finally came up with a workaround, which is to stick most of the query into an inline JavaScript string and shove it into the key part of a query parameter, so the endpoint looks like this:
https://api.balena-cloud.com/v6/device?{{ "$expand=is_running__release($select=id)&$select=id&$format=json;metadata" }}=none
In other words, use
- key =
{{"$expand=is_running__release($select=id)&$select=id&$format=json;metadata"}}
- value =
none
Hope this helps others and I hope Retool reconsiders this behavior. Happy to hear if anyone has other/better workarounds.