Вопрос

http://www.filesspecialtours.com/ER.png


To get "agrupaciones" I do:

GET /agrupaciones/

To get "asociados" I do:

GET /agrupaciones/asociados/

How to do to obtains the result of cross two resources?

agrupaciones., asociados.

Any common method for to do it?

Это было полезно?

Решение

Not sure exactly what you are trying to do because my Spanish isn't great, but if you want all "asociados" returned then return them in the "agrupaciones" resource. For example

GET /agrupaciones

{
    nombre: "Movie Club",
    asociados [
        {
            url: "/agrupaciones/asociados/1"
            nombre: "Bob",
            archivo_esp: "blah",
            archivo_por: "blah blah",
            ...
        },
        {
            url: "/agrupaciones/asociados/2"
            nombre: "Sally",
            archivo_esp: "blah2",
            archivo_por: "blah2 blah2",
            ...
        }
        ...
    ]
}

If you don't want to return that much data in one go you can just use the URL

GET /agrupaciones

{
    nombre: "Movie Club",
    asociados [
        {
            url: "/agrupaciones/asociados/1"
            nombre: "Bob",
        },
        {
            url: "/agrupaciones/asociados/2"
            nombre: "Sally",
        }
        ...
    ]
}

and then the client can follow the URL if they want further information about the member.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top