tmpim / Krist

Krist is a centralized-database economy system for Minecraft servers. Krist does not use a block-chain, or any similar technology. Krist is not a "cryptocurrency".
https://krist.dev/
GNU General Public License v3.0
24 stars 19 forks source link

Option to request plaintext responses #43

Closed Lignum closed 4 years ago

Lignum commented 6 years ago

As there is still a significant amount of people using the deprecated API, it seems necessary to aid with adoption of the current API. Some people actively use the deprecated interface because they do not like the fact that they have to parse JSON, because they feel that the inclusion of a library bloats their program, or because they simply do not know how.

Thus, I propose that we add an option to the API to return data in plaintext. This should be done by setting the Accept header in the request to text/plain, which should make the request contain only the most significant property of the requested object, if possible. For instance /work should respond with the work, /addresses/:address should respond with the balance of the address. Naturally, this behaviour would have to be documented. In some cases, such as responses returning lists of objects (like /transactions or /addresses), a plaintext format would be unreasonable. In such cases, the API should respond with an empty body and the status code 415 Unsupported Media Type.

dmarcuse commented 6 years ago

Hmm, I feel like this is adding effort that should really be done on the consumer's end. JSON is pretty standard and easy to use, and IMO we should instead be removing the old API and requiring people to use the new one. Otherwise, we'll end up having three separate APIs, two of which are documented.

Lemmmy commented 6 years ago

I agree; I feel we need to be focusing on deprecating the old API, and maintaining all of them would be a lot of hassle.

Lemmmy commented 6 years ago

prs welcome