I'm building a Json REST API for my application, and have some doubts about the design itself. My application has organizations and also equipment which belongs to organizations. That would be an example of the organizations API:
Loads all the organizations from the application
Loads a specific organization by id
This seems quite clear. However now I want to access equipment, which is accessible by id or code. The id is unique for the application, whereas the code is unique per organization. Some choices:
Loads the equipment by organization. This seems quite clear to me
Equipment by id. Isn't the organization id quite redundant here?
Seems it makes sense, but probably would be better to pass code as a parameter.
In my opinion, the methods below look better just for grabbing equipment (even if the return a list, while the method is supposed to return a single value or nothing). However I still have more relations into equipment, which these methods don't seem proper to fit. For example how to extend the API to integrate the methods to load files for each equipment?
It should be considered that organizations are structured hierarchically, so we've got organization trees and if org1 contains org2 and one equipment belongs to org2, it also belongs to org1.