Community
Participate
Working Groups
Our current REST API for preferences does this to change a single value: PUT /prefs/user/myprefs?key=Name&value=Gilgamesh However this puts a severe limit on the size of the preference value, since it must be encoded directly in the request URL. We should support a different format that puts the preference value in the request body: ---- PUT /prefs/user/myprefs?key=Name Very larger value goes here... -----
For PreferencesServlet: private String getBodyAsString(HttpServletRequest req) throws IOException { StringWriter writer = new StringWriter(); IOUtilities.pipe(req.getReader(), writer, true, false); return writer.toString(); }
Fixed. Putting a single value now uses a form-encoded request body, which is more standard for PUT operations. PUT /prefs/user/myprefs Orion-Version: 1.0 Content-Length: 21 Content-Type: "application/x-www-form-urlencoded" key=Name&value=Enkidu
Hmm... is that a complete representation of /prefs/user/myprefs or just a PATCH?
(In reply to comment #3) > Hmm... is that a complete representation of /prefs/user/myprefs or just a > PATCH? It is just a single key/value. This can also be expressed as the following if you prefer this equivalent syntax: PUT /prefs/user/myprefs?key=Name value=Frodo