Mentionables

This section describes how a mentionable works. A mentionable is an entity (an user or an organization) that can be mentioned in a body of text, to call out it's attention. For now, only users are mentionable and it is possible to mention them only in comments on an Expense or an Advancement or a Reimbursement. To mention a user you use its mention_name with @ as a preffix (@John, for example).

Mentionable Example

    {
      "id": 1,
      "name": "John Foo",
      "email": "john@example.com",
      "mention_name": "JohnFoo",
      "avatar": [
        {
          "style": "original",
          "url": "https://rexpense-uploads.s3.amazonaws.com/user_avatar/1/original/avatar.png",
          "width": 716,
          "height": 655,
          "expiration": "2014-06-27T20:31:43Z"
        },
        {
          "style": "medium",
          "url": "https://rexpense-uploads.s3.amazonaws.com/user_avatar/1/medium/avatar.png",
          "width": 300,
          "height": 300,
          "expiration": "2014-06-27T20:31:43Z"
        },
        {
          "style": "thumb",
          "url": "https://rexpense-uploads.s3.amazonaws.com/user_avatar/1/thumb/avatar.png",
          "width": 100,
          "height": 100,
          "expiration": "2014-06-27T20:31:43Z"
        }
        {
          "style": "tiny",
          "url": "https://rexpense-uploads.s3.amazonaws.com/user_avatar/1/tiny/avatar.png",
          "width": 48,
          "height": 48,
          "expiration": "2014-06-27T20:31:43Z"
        }
      ]
    }
    

List all mentionables

This endpoint lists all mentionable users of a specific resource (an Expense or an Advancement or a Reimbursement).

The response returns an HTTP ETag for caching and improving efficience. On your first request, you should save the returned ETag value and supply it on subsequent requests for the same resource. If you make a request providing an ETag and the resource has not changed on the server, it will respond with 304 Not Modified HTTP Status and an empty body.

Definition (mentionables of an Expense)

GET https://app.rexpense.com/api/v1/expenses/:expense_id/mentionables

Example Request

$ curl -u $YOUR_API_TOKEN:X -X GET https://app.rexpense.com/api/v1/expenses/1/mentionables \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json'

Response Example

ETag cde0a947653ebd83b7294edddb29ad37
    {
      "mentionables": [{ "id": 1, "name": "John", ... }]
    }
    

Example Request

$ curl -u $YOUR_API_TOKEN:X -X GET https://app.rexpense.com/api/v1/expenses/1/mentionables \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json'
      -H 'ETag: cde0a947653ebd83b7294edddb29ad37'

Response Example

304 Not Modified

Definition (mentionables of an Advancement)

GET https://app.rexpense.com/api/v1/advancements/:advancement_id/mentionables

Example Request

$ curl -u $YOUR_API_TOKEN:X -X GET https://app.rexpense.com/api/v1/advancements/1/mentionables \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json'

Response Example

ETag cde0a947653ebd83b7294edddb29ad37
    {
      "mentionables": [{ "id": 1, "name": "John", ... }]
    }
    

Example Request

$ curl -u $YOUR_API_TOKEN:X -X GET https://app.rexpense.com/api/v1/advancements/1/mentionables \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json'
      -H 'ETag: cde0a947653ebd83b7294edddb29ad37'

Response Example

304 Not Modified

Definition (mentionables of a Reimbursement)

GET https://app.rexpense.com/api/v1/reimbursements/:reimbursement_id/mentionables

Example Request

$ curl -u $YOUR_API_TOKEN:X -X GET https://app.rexpense.com/api/v1/reimbursements/1/mentionables \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json'

Response Example

ETag cde0a947653ebd83b7294edddb29ad37
    {
      "mentionables": [{ "id": 1, "name": "John", ... }]
    }
    

Example Request

$ curl -u $YOUR_API_TOKEN:X -X GET https://app.rexpense.com/api/v1/reimbursements/1/mentionables \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json'
      -H 'ETag: cde0a947653ebd83b7294edddb29ad37'

Response Example

304 Not Modified