logo
logo

Entity Relation Resource

Each relation on an entity defines a resource containing all the references to the related entities. This resource also conveys the order in which the related entities are stored in the entity.

The following methods are supported: GET, HEAD, PUT.

GET /api/entities/id/relations/relation

Returns an Entity Relation Object containing all the references to the related entities.

Example Request:

GET http://<hostname>/api/entities/1/relations/R1
Host: hostname
Accept: application/json

Example Response:

HTTP/1.1 200 OK
Content-Length: content length
Content-Type: application/json; charset=utf-8
ETag: "hash string"

{
    "children":[
        {
            "href":"http://<hostname>/entities/2"
        },
        {
            "href":"http://<hostname>/entities/3"
        }
    ],
    "self":{
        "href":"http://<hostname>/entities/1/relations/R1"
    }
}

PUT /api/entities/id/relations/relation

Updates the state of the related entities. All relations are updated, and the order in which they appear is maintained.

Hint: The system is agnostic on what are the valid IDs for a relation; hence it will allow setting a relation with a wrong object ID. It is the responsibility of the developer to make sure that the ID that is set in a relation is correct. In case a wrong ID is assigned on a relation the UI will not visualize the value, so from a user perspective wrong data will not be visualized.

Example Request:

PUT http://<hostname>/api/entities/1/relations/R1
Host: hostname
Content-Type: application/json

{
    "children":[
        {
            "href":"http://<hostname>/entities/2"
        }
    ],
    "self":{
        "href":"http://<hostname>/entities/1/relations/R1"
    }
}

Example Response:

HTTP/1.1 204 No Content

Can we improve this article ? Provide feedback