Reading the whole thread is confusing. So let me recap, if I do understand it right.
There is an existing convention, that is established between every server and every browser (client). The "content-type". It defines, how a server has to deliver content to the browser. So the browser is able to display it. This convention can not be changed, because every server has to work in the same way. ... To make it easier for me, I'm not using application/json for the beginning. Eg I did upload a "button image" tiddler in 2 different formats. [1] content-type: text/plain and [2] content-type:image/svg+xml If I request button-text-plain [1] with the browser https://dev.tweb.at/api/bags/default_public/tiddlers/button-text-plain ... I get the tiddler.fields.text as text -> OK If I request button-image [2] : GET https://dev.tweb.at/api/bags/default_public/tiddlers/button-image ... I get tiddler.fields.text - the browser shows an image, because of the response header: "Content-type: image/svg+xml; charset=UTF-8." -> right? -> OK So imo for TiddlyWeb as a content delivery service, this is the expected behaviour. For tiddlywiki the mechanism is slightly different than for the default browser. ... If you open the page [3] https://dev.tweb.at/ and click the "button-image" tiddler, then TiddlyWiki request: GET https://dev.tweb.at/api/bags/default_public/tiddlers/button-image --- Accept: "application/json" which is the same as if you click: https://dev.tweb.at/api/bags/default_public/tiddlers/button-image.json with the browser. What we get is a tiddler with a response header: "Content-type: application/json" -> OK ... but the tiddler contains a tiddler.fields.type, that tells TW to display it as "image/svg+xml" -> OK ... Cool the result for the browser and TiddlyWiki is the same. Both display an image, even if they did request different tings from the server. --------------- Now comes the crux. If I create a tiddler named: data-json type: application/json with the content {"key": "value"} Everything is perfectly fine if I click: https://dev.tweb.at/api/bags/default_public/tiddlers/data-json It returns: {"key": "value"} -> OK as expected for the browser. There has to be a possibility to get exactly that behaviour, because it my be needed that way. But if I open https://dev.tweb.at/ and open the "data-json" tiddler TiddlyWiki GET request header is Accept:"application/json" The server sends {"key": "value"} ... Which TiddlyWiki can't handle. ->> ERROR IMO if TiddlyWiki requests "Accept: application/json" the TiddlyWeb behaviour is right. The missing thing now is a possibility to retrieve the tiddler json representation. So that TW can handle it. ------------ a test only: https://dev.tweb.at/api/bags/default_public/tiddlers/data-json.txt is fine. ------------ I think the cleanest way is, TW changes the request to GET the tiddler json representation to: Accept: text/vnd.tiddlywiki+json If you have a look at: http://www.iana.org/assignments/media-types/media-types.xhtml There are several vnd.xxx+json definitions. So it should be ok. --------- IMO TiddlyWeb needs to change the mechanism too, because if I PUT application/json I expect this link: https://dev.tweb.at/api/bags/default_public/tiddlers/data-json to deliver application/json ... but there still needs to be a way to get the tiddler json representation. So imo : https://dev.tweb.at/api/bags/default_public/tiddlers/data-json.json should return it. Since ".json" is a convention that returns a tiddler it should be true for every tiddler. just my thoughts have fun! mario -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/tiddlywikidev. For more options, visit https://groups.google.com/d/optout.
