php - REST api resource dependencies -


I have this IP address management panel, which is related to the organization and the user is responsible for this.

Now I have the route / api / ip and / api / ip / {id} to get all or specific IP formats. Is:

  {"ip": "200.0.0.0", "mask": 32, "broadcast": "200.0.0.1"}  

Now when I select IP, I want to show IP information, information about the organization and the user who is responsible for it, information in one page.

Is it / api / ip / {id} :

  {"ip": "200.0.0.0", "mask" Required, ": 32," Broadcast ":" 200.0.0.1 "," Organization ": {/ * Organization Data * /}," User ": {/ * User Information *}}  

In this way I get all the information in the same request, but is it still the API?

Do I have to / api / ip / {id} / organization And get all the data I need in / api / ip / {id} / user and three different requests?

If not, then appropriate What will happen like this?

I'll do the last time by using the heathos, which will help you It is actually a great bundle for this, so the result will be:

/api/ip/127.0.0.1

  {"ip": "200.0.0.0", "mask": 32, "broadcast": "200.0.0.1", "_links": {"organization": "/api/ip/127.0. 0.1 / Organization "," User ":" /api/ip/127.0.0.1.1 "/ User"}}  

Comments