ID of resource objects containing "/" used in links


#1

In my json:api I have got resource objects (wiki pages) whose IDs may contain Slashes “/”. The json:api spec does not have an opinion about this. As soon as I generate links containing IDs this gets interesting. As far as I know the spec says nothing about encoding IDs in links.

Does one always urlencode IDs in links or are there other ways to deal with it?


#2

The spec has a strong convention for using identifiers which aren’t URI-like. However, there is a requirement for percent encoding the the parameterization capabilities of the system. If you’re using URI-like identifiers, I would suggest using percent encoding with the expectation on your server to receive those kinds of parameters.

One additional point is there is really no requirement that the server use numeric identifiers or anything else, I believe it is quite legitimate to use full URIs so you can (if you want) use the full web centric identifier within the document if you choose.