New answers tagged

4 votes
Accepted

HATEOAS API - best practice to create multiple entities in one request

What should I return when posting now to the endpoint which might have 1 or more created messages? How would you do it if your clients were web browsers? You'd presumably return a "status of the ...
VoiceOfUnreason's user avatar
1 vote

Why split up data retrieved from a database into multiple endpoints, if we need ALL the data anyway?

If you know clients usually need all the detailed data then it is perfectly fine to include it all in a single endpoint. But there may be requirements which cannot be solved with a single endpoint. If ...
JacquesB's user avatar
  • 59.5k
1 vote

How to mock REST services for testing

I would suggest you split this out into two tracks, unit testing and end-to-end (integration testing. It depends on what your goal is here. The question is, how can I mock the services B and C in ...
Flater's user avatar
  • 49.7k
12 votes

Why split up data retrieved from a database into multiple endpoints, if we need ALL the data anyway?

I'm working under the assumption that you are looking at an API that you did not develop and do not have access to the source or design details. If that's incorrect, please let me know. First off, it'...
JimmyJames's user avatar
  • 27.3k
8 votes

Why split up data retrieved from a database into multiple endpoints, if we need ALL the data anyway?

What is the point of splitting off the data into many different endpoints if we eventually need to display all the relevant info to the end customer anyways? The REST answer is: caching. Separating ...
VoiceOfUnreason's user avatar
19 votes
Accepted

Why split up data retrieved from a database into multiple endpoints, if we need ALL the data anyway?

Your assumption that you always need all the data is typically false. At least at the given time. You may have such a need with your game example, but it seems that even these API developers think ...
freakish's user avatar
  • 414
3 votes

Why split up data retrieved from a database into multiple endpoints, if we need ALL the data anyway?

The idea is to have multiple generic endpoints which can be combined to produce a variety of different results. So for example, say you include the developer list in the Game object as you suggest, ...
Ewan's user avatar
  • 75.6k
0 votes

How to build REST uri that fetches children by parent ID

One could also create another service. Parent Service Child Service Descendent Service Sample Service Methods GET /parent/{parentId} GET /child/{childId} GET /descendent/{id}?level={n} For the ...
Jon Raynor's user avatar
  • 11.5k
2 votes

How can I avoid duplicate annotations when validating both Entity and DTOs?

The problem here is that annotations tightly couple your class to some package, NHibernate? and Whatever validation package you are using. Ideally you would have a clean POJO class for your business ...
Ewan's user avatar
  • 75.6k
1 vote

How can I avoid duplicate annotations when validating both Entity and DTOs?

A potential solution would be declaring a new annotation type for each shared field and decorating it with the validation rules. @NotNull @NotBlank @Length(min = 3, max = 21) @Documented @Constraint(...
Marco Pierre White's user avatar

Top 50 recent answers are included