@ldalves wrote:
Guys, I’m sorry if this is a basic question, but since I’m quite new to ember, I’d like to know if there is any best practice for a case like this. For example, I have the follow endpoints that returns the payloads below:
https://api.example.com/v1/user
[ { "user": "user1", "firstName": "Foo1", "lastName": "Bar1", "url": "https://api.example.com/v1/user/user1" }, { "user": "user2", "firstName": "Foo2", "lastName": "Bar2", "url": "https://api.example.com/v1/user/user2" } ]
And each of the “url” endpoint returns something like this:
https://api.example.com/v1/user/user1
{ "user": "user1", "firstName": "Foo1", "lastName": "Bar1", "age": 21, "address": "User1 Address" ... more info ... }
We see that some properties in “/user” are repeated in “/user/user1”.
What would be the best practice to create the “user” model?
Should I have two models? Like for example a “users” model for the “/user” and a “user” model for “/user/user1”?
Could somehow have just one model “user” that would fit both endpoints?
Thanks in advance,
- Leandro
Posts: 1
Participants: 1