Accountabilities
This section describes the API of the accountability resource.
Parameters
id: | integer |
title: | string |
description: | string |
status: | string Valid statuses: opened, ready_to_review, analyzed, approved, finished |
expense_ids: | Array of expense_ids |
payer: | JSON object |
receiver: | JSON object |
Example of Accountability
List all accountabilities
Parameters
page: | integer |
per_page: | integer limit to 100 |
Definition
GET https://app.rexpense.com/api/v1/accountabilities
Example Request
$ curl -u $YOUR_API_TOKEN:X -X GET https://app.rexpense.com/api/v1/accountabilities \ -H 'Accept: application/json' \ -H 'Content-type: application/json'
Response Example
Create an accountability
Accountabilities can be created without expenses, and you can update the accountability with new expenses.
Parameters
title: | string |
description: | string |
expense_ids: | Array of integers |
payer: |
payer object attributes required
id: integer
type: string |
receiver: |
receiver object attributes required
id: integer
type: string |
Definition
PUT/PATCH https://app.rexpense.com/api/v1/accountability/:id
Example Request
$ curl -u $YOUR_API_TOKEN:X -X PATCH https://app.rexpense.com/api/v1/accountability/:id \ -H 'Accept: application/json' \ -H 'Content-type: application/json' \ -d '{"title": "titulo atualizado", "expense_ids": [1, 2, 3]}'
Response Example Success
HTTP 200 OK
Example Response Failure when update expense_ids and accountability not have opened status
HTTP 402 Payment Required
Show an accountability
This request shows the accountability complete information.
Parameters
id: | integer required |
Definition
GET https://app.rexpense.com/api/v1/accountability/:id
Example Request
$ curl -u $YOUR_API_TOKEN:X -X POST https://app.rexpense.com/api/v1/accountability/1 \ -H 'Accept: application/json' \ -H 'Content-type: application/json'
Response Example Success
HTTP 200 OK
Response Example Failure
HTTP 404 Record Not Found
Update an accountability
The accountability can be updated by any user, but a member can add or remove expenses when accountability have status opened. The analyst, manager and admin can add or remove expenses when accountability have status read_to_review.
Parameters
title: | string |
description: | string |
expense_ids: | Array of integers |
payer: |
payer object attributes required
id: integer
type: string |
receiver: |
receiver object attributes required
id: integer
type: string |
Definition
PUT/PATCH https://app.rexpense.com/api/v1/accountability/:id
Example Request
$ curl -u $YOUR_API_TOKEN:X -X PATCH https://app.rexpense.com/api/v1/accountability/:id \ -H 'Accept: application/json' \ -H 'Content-type: application/json' \ -d '{"title": "titulo atualizado", "expense_ids": [1, 2, 3]}'
Response Example Success
HTTP 200 OK
Example Response Failure when update expense_ids and accountability not have opened status
HTTP 402 Payment Required
Destroy an accountability
To destroy a accountability you have to be an Organization's Administrator or Manager (have any relation with the payer).
Definition
DELETE https://app.rexpense.com/api/v1/accountability/:id
Example Request
$ curl -u $YOUR_API_TOKEN:X -X DELETE https://app.rexpense.com/api/v1/accountability/:id \ -H 'Accept: application/json' \ -H 'Content-type: application/json'
Response Example
HTTP 204 NO CONTENT
Change accountability status
The accountability can have the status: ['opened', 'ready_to_review', 'analyzed', 'approved', 'finished']
opened means that the user is still adding expenses in accountability
read_to_review means that the accountability is ready to be reviwed by analysts, managers and admins. In this status only analysts, managers and admins can add or remove expenses from accountability
analyzed means that the accountability is ready to be approved
approved will verify if all expenses are approved and the prepare accountability to be finished
finished will execute actions to liquidate all expenses by yours liquidate forms (create reimbursement, change status to liquidated of expenses liquidated by advancement)
Parameters
status: | string |
Definition
PUT https://app.rexpense.com/api/v1/accountability/:id/status
Example Request
$ curl -u $YOUR_API_TOKEN:X -X PUT https://app.rexpense.com/api/v1/accountability/:id/status \ -H 'Accept: application/json' \ -H 'Content-type: application/json' -d '{"status": "finished"}'