Question

URL encoding of tilde (~) sign

  • 27 November 2018
  • 2 replies
  • 1574 views

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



2 replies

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


Ah. Yes. Thanks.

Reply