Comments

An Expense or an Advancement or a Reimbursement can have several comments, which belongs to an user and has a content.

Parameters

content: string
user: user object representation

Example Comment

    {
      "id": 1,
      "content": "Foo bar comment",
      "created_at": "2014-10-10T14:17:56Z",
      "updated_at": "2014-10-10T14:17:56Z",
      "user": {
        "id": 1,
        "first_name": "John",
        "last_name": "",
        "emails": [
          {
            "email": "email@rexpense.com",
            "main": true
          }
        ],
        "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"
          }
        ]
      },
      "mentioned_users": [
        {
          "name": "John Foo",
          "email": "john@example.com",
          "mention_name": "JohnFoo",
          "avatar": [
            {
              "style": "original",
              "url": "https://rexpense-uploads.s3.amazonaws.com/user_avatar/2/original/avatar.png",
              "width": 716,
              "height": 655,
              "expiration": "2014-06-27T20:31:43Z"
            },
            {
              "style": "medium",
              "url": "https://rexpense-uploads.s3.amazonaws.com/user_avatar/2/medium/avatar.png",
              "width": 300,
              "height": 300,
              "expiration": "2014-06-27T20:31:43Z"
            },
            {
              "style": "thumb",
              "url": "https://rexpense-uploads.s3.amazonaws.com/user_avatar/2/thumb/avatar.png",
              "width": 100,
              "height": 100,
              "expiration": "2014-06-27T20:31:43Z"
            }
            {
              "style": "tiny",
              "url": "https://rexpense-uploads.s3.amazonaws.com/user_avatar/2/tiny/avatar.png",
              "width": 48,
              "height": 48,
              "expiration": "2014-06-27T20:31:43Z"
            }
          ]
        }
      ],
      "_links": [
        {
          "rel": "self",
          "method": "GET",
          "href": "https://app.rexpense.com/api/v1/expenses/1/comments/1"
        },
        {
          "rel": "update",
          "method": "PUT",
          "href": "https://app.rexpense.com/api/v1/expenses/1/comments/1"
        },
        {
          "rel": "destroy",
          "method": "DELETE",
          "href": "https://app.rexpense.com/api/v1/expenses/1/comments/1"
        }
      ]
    }
    

List all comments

Retrieve the list of comments of an Expense or an Advancement or a Reimbursement. It will return a JSON containing the name of the resource with an array of the objects requested using the comment representation and informations like the total of objects, current page and total pages.

If the content of the comments have emojis, they will be rendered as text code by default (for example, :smile:). However, if you'd like to get the unicode of the emojis instead, you should supply a emoji_in_unicode boolean param.

Parameters

page: integer
per_page: integer limit to 100
emoji_in_unicode: boolean

Definition (comment of an Expense)

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

Example Request

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

Example Response

    {
      "count": 1,
      "current_page": 1,
      "total_pages": 1,
      "comments": [
        {
          "id": 1,
          "content": "My first comment"
          ...
        }
      ]
    }
    

Definition (comment of an Advancement)

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

Example Request

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

Example Response

    {
      "count": 1,
      "current_page": 1,
      "total_pages": 1,
      "comments": [
        {
          "id": 1,
          "content": "My first comment"
          ...
        }
      ]
    }
    

Definition (comment of a Reimbursement)

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

Example Request

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

Example Response

    {
      "count": 1,
      "current_page": 1,
      "total_pages": 1,
      "comments": [
        {
          "id": 1,
          "content": "My first comment"
          ...
        }
      ]
    }
    

Show a comment

Retrieve a specific comment of an Expense, an Advancement or a Reimbursement. Returns a detailed representation of the comment.

If the content of the comments have emojis, they will be rendered as text code by default (for example, :smile:). However, if you'd like to get the unicode of the emojis instead, you should supply a emoji_in_unicode boolean param.

Parameter

emoji_in_unicode: boolean

If the Expense or Advancement or Reimbursement is deleted, the request will return a 410 Gone HTTP status with an empty body.

Definition (comment of an Expense)

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

Example Request

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

Example Response

    {
      "id": 1,
      "content": "My first comment",
      ...
    }
    

Definition (comment of an Advancement)

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

Example Request

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

Example Response

    {
      "id": 1,
      "content": "My first comment",
      ...
    }
    

Definition (comment of a Reimbursement)

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

Example Request

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

Example Response

    {
      "id": 1,
      "content": "My first comment",
      ...
    }
    

Create a comment

This request creates a new comment.

Parameter

content: string

Content field has support for Emojis. To know more about it, please visit Emoji section.

You can provide emojis in two forms: as text code (:+1:, for example) or unicode.

Expired organization

If the organization is expired, it will return an 402 error.

Definition (comment of an Expense)

POST https://app.rexpense.com/api/v1/expenses/:expense_id/comments

Example Request

$ curl -u $YOUR_API_TOKEN:X -X POST https://app.rexpense.com/api/v1/expenses/1/comments \
        -H 'Accept: application/json' \
        -H 'Content-type: application/json' \
        -d '{"content": "My second comment"}'

Response Example Success

HTTP 201 CREATED
    {
      "id": 2,
      "content": "My second comment",
      ...
    }
    

Response Example Failure

HTTP 422 Unprocessable Entity
    {
      "errors": {
        "content": ["can't be blank"]
      }
    }
    

Definition (comment of an Advancement)

POST https://app.rexpense.com/api/v1/advancements/:advancement_id/comments

Example Request

$ curl -u $YOUR_API_TOKEN:X -X POST https://app.rexpense.com/api/v1/advancements/1/comments \
        -H 'Accept: application/json' \
        -H 'Content-type: application/json' \
        -d '{"content": "My second comment"}'

Response Example Success

HTTP 201 CREATED
    {
      "id": 2,
      "content": "My second comment",
      ...
    }
    

Definition (comment of a Reimbursement)

POST https://app.rexpense.com/api/v1/reimbursements/:reimbursement_id/comments

Example Request

$ curl -u $YOUR_API_TOKEN:X -X POST https://app.rexpense.com/api/v1/reimbursements/1/comments \
        -H 'Accept: application/json' \
        -H 'Content-type: application/json' \
        -d '{"content": "My second comment"}'

Response Example Success

HTTP 201 CREATED
    {
      "id": 2,
      "content": "My second comment",
      ...
    }
    

Response Example Failure

HTTP 422 Unprocessable Entity
    {
      "errors": {
        "content": ["can't be blank"]
      }
    }
    

Example Response Failure when organization is expired

HTTP 402 Payment Required
    {
      "errors": {
        "message": "This organization is expired and in read-only mode until this situation have been solved."
      }
    }
    

Update a comment

Updates a comment of an Expense or an Advancement or a Reimbursement. Returns a detailed representation of the comment updated.

Parameter

content: string

Content field has support for Emojis. To know more about it, please visit Emoji section.

You can provide emojis in two forms: as text code (:+1:, for example) or unicode.

Expired organization

If the organization is expired, it will return an 402 error.

Definition (comment of an Expense)

PUT https://app.rexpense.com/api/v1/expenses/:expense_id/comments/:id

Example Request

$ curl -u $YOUR_API_TOKEN:X -X PUT https://app.rexpense.com/api/v1/expenses/1/comments/2 \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json' \
      -d '{"content":"My updated comment"}'

Example Response Success

HTTP 200 OK
    {
      "id": 2,
      "content": "My updated comment",
      ...
    }
    

Example Response Failure

HTTP 422 Unprocessable Entity
    {
      "errors": {
        "content": ["can' be blank"]
      }
    }
    

Definition (comment of an Advancement)

PUT https://app.rexpense.com/api/v1/advancements/:advancement_id/comments/:id

Example Request

$ curl -u $YOUR_API_TOKEN:X -X PUT https://app.rexpense.com/api/v1/advancements/1/comments/2 \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json' \
      -d '{"content":"My updated comment"}'

Example Response Success

HTTP 200 OK
    {
      "id": 2,
      "content": "My updated comment",
      ...
    }
    

Definition (comment of an Reimbursement)

PUT https://app.rexpense.com/api/v1/reimbursements/:reimbursement_id/comments/:id

Example Request

$ curl -u $YOUR_API_TOKEN:X -X PUT https://app.rexpense.com/api/v1/reimbursements/1/comments/2 \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json' \
      -d '{"content":"My updated comment"}'

Example Response Success

HTTP 200 OK
    {
      "id": 2,
      "content": "My updated comment",
      ...
    }
    

Example Response Failure

HTTP 422 Unprocessable Entity
    {
      "errors": {
        "content": ["can' be blank"]
      }
    }
    

Example Response Failure when organization is expired

HTTP 402 Payment Required
    {
      "errors": {
        "message": "This organization is expired and in read-only mode until this situation have been solved."
      }
    }
    

Remove a comment

Destroy a comment of an Axpense or an Advancement or a Reimbursement.

Expired organization

If the organization is expired, it will return an 402 error.

Definition (comment of an Expense)

DELETE https://app.rexpense.com/api/v1/expenses/:expense_id/comments/:id

Example Request

$ curl -u $YOUR_API_TOKEN:X -X DELETE https://app.rexpense.com/api/v1/expenses/:expense_id/comments/:id \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json'

Example Response Success

HTTP 204 NO CONTENT

Definition (comment of an Advancement)

DELETE https://app.rexpense.com/api/v1/advancements/:advancement_id/comments/:id

Example Request

$ curl -u $YOUR_API_TOKEN:X -X DELETE https://app.rexpense.com/api/v1/advancements/:advancement_id/comments/:id \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json'

Example Response Success

HTTP 204 NO CONTENT

Definition (comment of an Reimbursement)

DELETE https://app.rexpense.com/api/v1/reimbursements/:reimbursement_id/comments/:id

Example Request

$ curl -u $YOUR_API_TOKEN:X -X DELETE https://app.rexpense.com/api/v1/reimbursements/:reimbursement_id/comments/:id \
      -H 'Accept: application/json' \
      -H 'Content-type: application/json'

Example Response Success

HTTP 204 NO CONTENT

Example Response Failure when organization is expired

HTTP 402 Payment Required
    {
      "errors": {
        "message": "This organization is expired and in read-only mode until this situation have been solved."
      }
    }