---
title: "Entity relation"
slug: "entity-relation-1523352"
abstract: ""
---
# Entity relation

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](https://doc.sitecore.com/ch/en/developers/cloud-dev/entity-relation.html "Entity relation") containing all the references to the related entities.

Example Request:

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

```

Example Response:

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

{
    "children":[
        {
            "href":"http://<hostname>/api/entities/2"
        },
        {
            "href":"http://<hostname>/api/entities/3"
        }
    ],
    "self":{
        "href":"http://<hostname>/api/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:

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

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

```

Example Response:

```text
HTTP/1.1 204 No Content

```