Fork me on GitHub

Just as Web pages have links to other pages, resources of our API have references to other related resources. These references are accessible via the property links in the resource representation.

This feature makes possible that applications which use the API do not need to know previously all the possible URLs. For instance, when getting the user representation (GET /api/me), it is possible to access their enrollments via the link whose rel is enrollment:

{
    "links": [
        { "rel": "enrollments",
          "href": "http://www.redu.com.br/api/users/julianalucena/enrollments" }
    ]
}

For more information about the motivations and benefits of links, we recommend you read this paper.

A link mandatorily has the following attributes:

1. rel: Identifies the link.
2. href: Link of the resource in REST API.

It also has, optionally, the following attributes:

1. name: Resource name.
2. permalink: Link of resource in the Web interface.

Example of links in the Status representation:

{
    "links": [
        {
            "name": "Graduação em Ciência da Computação",
            "href": "http://www.redu.com.br/api/courses/graduacao-em-ciencia-da-computacao",
            "rel": "course",
            "permalink": "http://www.redu.com.br/ium/cursos/graduacao-em-ciencia-da-computacao"
        },
        {
            "href": "http://www.redu.com.br/api/statuses/1130/answers",
            "rel": "answers"
        },
        {
            "href": "http://www.redu.com.br/api/users/alexodrosgomes",
            "rel": "user"
        },
        {
            "href": "http://www.redu.com.br/api/statuses/1130",
            "rel": "self"
        },
        {
            "name": "Centro de Informática",
            "href": "http://www.redu.com.br/api/environments/ium",
            "rel": "environment",
            "permalink": "http://www.redu.com.br/ium"
        },
        {
            "name": "if681 - Interface Usuário Máquina",
            "href": "http://www.redu.com.br/api/spaces/62",
            "rel": "space",
            "permalink": "http://www.redu.com.br/espacos/62"
        },
        {
            "href": "http://www.redu.com.br/api/spaces/62",
            "rel": "statusable"
        }
    ],
    "created_at": "2011-05-12T18:07:31-03:00",
    "text": "Pessoal,o módulo de orientação do segundo workshop já está criado. Postem suas dúvidas nele que estarei respondendo",
    "answers_count": 4,
    "updated_at": "2011-09-22T17:47:24-03:00",
    "id": 1130,
    "type": "Activity"
}