Best practice for delimiters in HTTP URL path

Would it be unreasonable to use different punctuation characters in the URL of the HTTP URL? I am in the process of determining resource URLs for the API. These resource URLs must be accessible, stored and shared with a wide range of clients and middleware, so it is important that they do not contain characters that may cause problems.

RFC 3986, section 2.2. "Reserved characters" defines the following characters as sub-divisors :! $ & '() * + ,; =

Are any of these illegal for arbitrary use in URLs in an HTTP scheme?

Even if they are legal in accordance with the standards, is any of them likely to have problems with real interoperability due to inappropriate software?

Are there any specific subdivisions that you previously used without problems in a widely deployed API (this may indicate that the ones you used are safe)?

The motivation is that we need to distinguish between key-value pairs that do not have hierarchical semantics. We review this: http://doriantaylor.com/policy/http-url-path-parameter-syntax . However, if this could be a problem, we will just do http://example.com/key1/value1/key2/value2

thanks

+6
source share
1 answer

Whatever way you go, be sure of it; changing APIs can be problematic even with the specified version. It is a bad idea to have multiple locations for the same resource - there must be one canonical location. Although in theory you can use HTTP 301 redirects, if compatibility concerns you, it is best to avoid.

The Dorian Taylor dialing scheme looks reasonable (and completely legal) and should not give any compatibility problems with any system (or with any of them, which is not a big mistake).

If your URL should be used as a parameter in the new URL, the slash and equal should be percent encoded , but this is true for both the standard query string ( ?&= ) And the proposed alternative, as well as :// if the protocol is enabled. Obviously, if you want to use ;,= in your values, you need to encode them.

The only possible problem that I see is that your URLs are stored in CSV, but CSV libraries are shared and special characters are clearly defined.

0
source

Source: https://habr.com/ru/post/895459/


All Articles