URL encoding of tilde (~) sign

  • 1
  • Question
  • Updated 2 weeks ago
I'm setting up an API connection to our management dashboard tool. It has strict URL encoding rules to poll APIs. So I can't ask it to poll:

https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/

Because the tilde should be escaped to be:

https://platform.devtest.ringcentral.com/restapi/v1.0/account/%7e/

However if I try this URL (or without the trailing forward slash), Ringcentral returns a 401 error.

Any ideas?

Thanks,
Andrew
Photo of Andrew Forsyth

Andrew Forsyth

  • 80 Points 75 badge 2x thumb

Posted 2 weeks ago

  • 1
Photo of Anton Nikitin

Anton Nikitin, Official Rep

  • 2,934 Points 2k badge 2x thumb
Andrew,

according to RFC 2396 (https://tools.ietf.org/html/rfc2396) :

2.3. Unreserved Characters
   Data characters that are allowed in a URI but do not have a reserved
purpose are called unreserved. These include upper and lower case
letters, decimal digits, and a limited set of punctuation marks and
symbols. unreserved = alphanum | mark mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" Unreserved characters can be escaped without changing the semantics
of the URI, but this should not be done unless the URI is being used 
   in a context that does not allow the unescaped character to appear.
At the same time we do support encoded tilde character. Your issue is most likely not because of a tilde escaping but due to missing or invalid access token provided in "Authorization" header.

Here is the example of successful request I could send:

GET https://platform.devtest.ringcentral.com/restapi/v1.0/account/%7e HTTP/1.1 Accept-Encoding: gzip,deflate Authorization: Bearer SUFEMD...VKaUxDZ1lyS3pRVHRVVHBRfEFB


Photo of Andrew Forsyth

Andrew Forsyth

  • 80 Points 75 badge 2x thumb
Ah. Yes. Thanks.