Hot answers tagged

4

I think you might be missing a resource... have you considered a /team/myteam/player_positions resource? There are some also comments about PATCH not being supported... I wouldnt be too concerned about that if you're building both the server and the client, so use it if it makes sense for you. That being said, using PUT to fully update a resource called /...


4

There are two reasons for catching an exception To convert the exception to a different exception, so that internal implementation details are not exposed to users of a module. An example could be that you want to turn a Kubernetes "no such pod" exception into a more generic Repository exception "item not found". These catch clauses should be within the ...


4

Is the update a rewrite or an append? If I update my profile by adding 1 word to it, such that applying this 100 times gives me a profile with 100 words then this is not idempotent and should be a POST. If applying this 100 times gives me the same 1 word profile every time then it is idempotent and could be a PUT. Idempotence is an important concept in ...


4

It is a relevant question when hosting on cloud which may be the reason behind the question. There it is normal for each service have a price table e.g $ 0.05 for 1000 requests or something like that. If you are hosting on-prem the answer is amortized between the hardware. The people maintaining the hardware and the internet connection. In other words: if ...


3

A string is a totally unsuitable data structure to identify a language. That's because you'd have to specify how to interpret the text in the string (out of "French", "französisch", "franzoesisch", "Français", "Francais", "FR", which specify a language?), and it is not clear at all whether a string represents a language or not. So your application should ...


2

In my mind, the correct way to specify a language in an API is an enum. An enum is an exhaustive list of discrete values. This also acts as a guardrail at compile time, because unsupported values can't compile. There will be an impedance mismatch because JSON doesn't have enums, but JSON libraries can up/downconvert from string to enum. ToString() has ...


2

REST is really only well specified for CRUD operations on objects and sets. Furthermore, PUT replaces the resource in its entirety. So technically if you were to update each player with a position, you'd have to read and write all fields. Not everyone does it that way. I prefer to POST a command object, i.e. POST http://.../teams/myteam/reorder { "...


1

At a very high level, it sounds like your workflow is Download a copy of the server's current representation of the list of players Make edits to your local copy Request that the server modify it's copy of the resource to match yours. That's right in the sweet spot of HTTP; the flow would normally look like: GET /teams/myteam/players // Make your local ...


1

Firstly, PATCH is not officially supported, so, using it would be a considerable bottleneck before even thinking about anything else. If possible, steer away from it. Secondly, before sending anything to the server, try and ensure data consistency and validation on the front-end or even UI side, anything that ensures you that before you click your Save or ...


1

There is no silver bullet in this scenario, but you have to evaluate a solution for each customization aspect that you have to face in time, trying to keep separate the core api from customized services If customers just need to extend the information associated to some resource (company, user, asset) the most flexible solution is the introduction of ...


1

To make such a calculation, you start by making a list of cost factors and find out the weekly costs for each of them: costs for your networking provider the hardware (renting price, or purchasing price divided by deprecation period, broken down to a price/week), including backup systems, backup storage systems etc. costs for any software required to run ...


1

There is only one reason to catch An Exception - to do something "useful" with it. Question: Do you "screen" every telephone call that comes into your office building on the off-chance that it might be relevant to you and "throw back" [all] the ones that aren't? Of course not. It's the same with Exceptions. Catch those that you can usefully handle ...


1

Service dependencies (and losing track thereof) are not uncommon with a microservice architecture. It's also expected that services have local data and this data can be keyed with a primary ID from another service. For example, some services are going to have some data attached to a user ID like you observed. You should look at whether or not you have drawn ...


1

It's against guidelines Not all strings are valid languages, and casting one could result in a run-time error. According to the MS guidelines for casting types: Do not throw exceptions from implicit casts because it is very difficult for the developer to understand what is happening. Since your implicit operator could throw, it's probably not a great ...


Only top voted, non community-wiki answers of a minimum length are eligible