Fork me on GitHub

Status – message posted in a timeline – is the core of communication in Redu. By using them, the users can post comments, answers, and help requests. Additionally, statuses are the way in which the transactions on the social network are shown. In the API context, any element in a Redu timeline is called status.

Types of status

Status is the resource which represents a transaction in Redu. According to the type of transaction, the status has a different type (specified by type).

All types of Status have the following properties:

Attribute Description Example
id Unique identifier of Status 1
type Type of status Activity, Help, Answer, and Log
created_at Date of creation for Status 2013-03-13T23:47:25-03:00
user Representation of user who has created the status See User
text Text that is written by user or system message "added to your network of contacts"

Activity

Activity statuses are the kind of transaction that are explicitly created by the user. For example, a post on the timeline of a space or user creates a status of Activity type. This one is the most common type of status.

The Activity status can be replied by other people. Such answers are accessible via the link answers. Furthermore, the Activity is related to user and statusable. See examples below:

Link Description Example
user Link to the user who has created the status http://www.redu.com.br/api/users/guiocavalcanti
answers Link to Activity answers http://www.redu.com.br/api/statuses/107070/answers
statusable Link to resource where the Activity was created http://www.redu.com.br/api/lectures/5874-apresentacao. It may be User, Space, or Lecture
self Link to Activity which is being viewed http://www.redu.com.br/api/statuses/1212
Attribute Description Example
answers_count Number of answers 3

Help

Help status is very similar to the Activity one. It represents help requests or questions from users. They can only be created on timelines of lectures. At the end of the day, a Help status has the same function as an Activity one, but there is only one restriction about the places where they can be created, and the representation in the interface (see image).

Help status can also be replied by other people. Such answers are acessible via the link answers. Furthermore, the Activity is related to user and statusable through links. See examples below:

Link Description Example
user Link to the user who has created the status http://www.redu.com.br/api/users/guiocavalcanti
answers Link to Help answers http://www.redu.com.br/api/statuses/107070/answers
statusable Link to resource where Help was created http://www.redu.com.br/api/lectures/5874-apresentacao. It may just be a Lecture
self Link to Help which is being viewed http://www.redu.com.br/api/statuses/1212
Attribute Description Example
answers_count Number of answers 7

Answer

As stated above, Activity and Help statuses can be replied by other users. And it is now that we need the Answer status. They relate to a status via the link in_response_to. Unlike Activity and Help, Answer statuses cannot be replied.

Link Description Example
user Link to the user who has created the status http://www.redu.com.br/api/users/guiocavalcanti
in_response_to Link to the Activity or Help which created that answer http://www.redu.com.br/api/statuses/107070/answers
self Link to Answer which is being viewed http://www.redu.com.br/api/statuses/1212
Attribute Description Example
id Unique identifier of Status 1
type Type of status Activity, Help, Answer, and Log
created_at Date of creation for Status 2013-03-13T23:47:25-03:00
user Representation of user who has created the status See User
text Text that is written by user or system message "added to your network of contacts"

Log

This is the only type of Status which does not depend on action of user to be created. Log statuses are generated automatically by Redy when certain actions happen. For example, when the user updates their profile on Redu, a log is created representing that action.

Overall, Logs are used to represent changes on Redu users. The actions that create logs are:

  • Addition of Lectures within a Subject (logeable_type Lecture)
  • Creation of Subject (logeable_type Subject)
  • Creation of Course (logeable_type Course)
  • Enrollment in Course (logeable_type Enrollment)
  • Modification of User profile in Course (logeable_type User)
  • Connection requested in Course (logeable_type Friendship)

Besides the attributes that Activity, Help, and Answer have, Log has a logeable_type attribute that represents the object type which Log is associate to. For instance, the creation of a lecture generates a Log which logeable_type is Lecture. In addition, the Log has a link associated to itself to the logeable entity. In the previous example, the logeable link would contain the address to the lecture created.

GET /api/statuses/:status_id

Returns a status with the specified ID.

Parameters

Parameter Description Restrictions
:status_id Status ID N/A

GET /api/statuses/:status_id/answers

Returns answers of a status. It is applied to Help and Activity types.

Parameters

Parameter Description Restrictions
:status_id Status ID N/A

POST /api/statuses/:status_id/answers

Creates an Answer status in response to an Activity or Help.

Parameters

Parameter Description Restrictions
status_id ID of status in question Activity or Help only
status[text] It is a reply to a comment or help request Maximum 800 characters

GET /api/users/:user_id/statuses

Returns all statuses from the user. You can also filter by the type. If :type is not given, the Activity, Help, and Log statuses from the user are returned.

Parameters

Parameter Description Restrictions
user_id ID of user in question N/A
type ou types[] Filter by status type It may be Activity, Help, or Log. More than one type can be specified by using the option types[].
logeable_type It must be used together with the type. This allows you to filter Logs based on attribute logeable_type User, Friendship, Enrollment
page Pagination of results. Pages have 25 entries. The default one is 1 Number

Example

Request:

GET /api/users/:user_id/statuses?type=Activity

Response:

[{
  "type": "Activity",
    "links": [
    {
      "rel": "self",
      "href": "http://www.redu.com.br/api/statuses/34676"
    },
    {
      "rel": "statusable",
      "href": "http://www.redu.com.br/api/spaces/521"
    },
    {
      "rel": "user",
      "href": "http://www.redu.com.br/api/users/guiocavalcanti"
    },
    {
      "rel": "answers",
      "href": "http://www.redu.com.br/api/statuses/34676/answers"
    }
  ],
    "user": {
      "social_networks": [
      {
        "name": "facebook",
        "profile": "www.facebook.com/guiocavalcanti"
      },
      {
        "name": "linkedin",
        "profile": "br.linkedin.com/in/guiocavalcanti"
      },
      {
        "name": "twitter",
        "profile": "www.twitter.com/guiocavalcanti"
      }
      ],
        "thumbnails": [
        {
          "href": "http://s3.amazonaws.com/redu_uploads/users/avatars/4/thumb_32/Guilherme3x4%20copy.jpg?1323711306",
          "size": "32x32"
        },
        {
          "href": "http://s3.amazonaws.com/redu_uploads/users/avatars/4/thumb_110/Guilherme3x4%20copy.jpg?1323711306",
          "size": "110x110"
        }
      ],
        "birthday": "1987-11-24",
        "localization": "Recife, Brasil",
        "first_name": "Guilherme",
        "email": "guilhermec@redu.com.br",
        "links": [
        {
          "rel": "self",
          "href": "http://www.redu.com.br/api/users/guiocavalcanti"
        },
        {
          "rel": "enrollments",
          "href": "http://www.redu.com.br/api/users/guiocavalcanti/enrollments"
        },
        {
          "rel": "statuses",
          "href": "http://www.redu.com.br/api/users/guiocavalcanti/statuses"
        },
        {
          "rel": "timeline",
          "href": "http://www.redu.com.br/api/users/guiocavalcanti/statuses/timeline"
        },
        {
          "rel": "contacts",
          "href": "http://www.redu.com.br/api/users/guiocavalcanti/contacts"
        }
      ],
        "mobile": "+55 (81) 3333-3333",
        "friends_count": 98,
        "last_name": "Cavalcanti",
        "login": "guiocavalcanti",
        "id": 4,
        "birth_localization": "Recife, Brasil"
    },
    "id": 34676,
    "created_at": "2012-07-02T13:53:50-03:00",
    "text": "Todos os componentes da interface do Redu agora são opensource!\r\n\r\nVocês são livres para utilizar os CSS e JavaScript dentro nas suas aplicações. Para incluir e utilizar basta ir em: http://developers.redu.com.br/ui-components\r\n\r\nNo canto superior direito tem um índice de todos os elementos e sobre como cria-los.",
    "answers_count": 6
}]

GET /api/users/:user_id/statuses/timeline

Returns all statuses from the user, and courses which the user belongs to. Unlike the previous one, here we have all transactions of interest to the user. It is the same as you see on the Redu homepage.

Parameters

Parameter Description Restrictions
user_id ID of user in question N/A
type ou types[] Filter by status type It may be Activity, Help, or Log. More than one type can be specified by using the option types[].
logeable_type It must be used together with the type. This allows you to filter Logs based on attribute logeable_type User, Friendship, CourseEnrollment
page Pagination of results. Pages have 25 entries. The default one is 1 Number

POST /api/users/:user_id/statuses

Creates an Activity status on user timeline.

Parameters

Parameter Description Restrictions
user_id ID of user in question N/A
status[text] Content of status Maximum 800 characters

GET /api/spaces/:space_id/statuses/timeline

Returns all statuses from space and its lectures. Unlike the previous one, here we have both posts of the space and its lectures. It is the same as you see on the space timeline.

Parameters

Parameter Description Restrictions
space_id Space ID N/A
type ou types[] Filter by status type It may be Activity, Help, or Log. More than one type can be specified by using the option types[].
logeable_type It must be used together with the type. This allows you to filter Logs based on attribute logeable_type User, Friendship, CourseEnrollment
page Pagination of results. Pages have 25 entries. The default one is 1 Number

GET /api/spaces/:space_id/statuses

Returns all statuses from a space timeline. There is the possibility to filter the status of space by the type. It is important to note that the posts listed here are limited to those posted directly on the space timeline.

Parameters

Parameter Description Restrictions
space_id Space ID N/A
type ou types[] Filter by status type It may be Activity, Help, or Log. More than one type can be specified by using the option types[].
logeable_type It must be used together with the type. This allows you to filter Logs based on attribute logeable_type User, Friendship, CourseEnrollment
page Pagination of results. Pages have 25 entries. The default one is 1 Number

POST /api/spaces/:space_id/statuses

Creates a status on the space timeline.

Parameters

Parameter Description Restrictions
space_id ID of space in question N/A
status[text] Content of status Maximum 800 characters

Timeline of a Lecture

GET /api/lectures/:lecture_id/statuses

Returns all statuses from a lecture timeline. You can filter the statuses of a lecture by type.

Parameters

Parameter Description Restrictions
lecture_id ID of lecture in question N/A
type ou types[] Filter by status type It may be Activity, Help, or Log. More than one type can be specified by using the option types[].
logeable_type It must be used together with the type. This allows you to filter Logs based on attribute logeable_type User, Friendship, CourseEnrollment

POST /api/lectures/:lecture_id/statuses

Creates a status on the lecture timeline. Only in this case, it is allowed to create a Help.

Parameters

Parameter Description Restrictions
:lecture_id ID of lecture in question N/A
status[text] Content of status Maximum 800 characters’
status[type] Type of status Activity or Help

DELETE /api/statuses/:status_id

Deletes the status.

Parameters

Parameter Description Restrictions
:status_id Status ID N/A