mercredi 3 juin 2015

Ember (data): design a REST API - related resources and nested urls

I have two resources in my system users and organizations. Each has a name and a relation with the other (many to many).

In my REST API I have:

/organizations - returns all organizations in the system (public)

/users - return all users in the system (public)

  1. After this I needed to add properties to the relation (e.g. role in the organization).
    • How do you propose I design the JSON in the response?

--

  1. We need to display to the organization admin all the workers in the organization, for that we defined a new REST endpoint:

/organizations/ID/users - returns all users in the organization (private)

  • How do I configure Ember to fetch this 'users' when displaying the organization details?
  • And how to handle the creation of new relations?



Aucun commentaire:

Enregistrer un commentaire