Advancement Devolutions
This section describes the API of the advancement devolution resource.
Parameters
id: | integer |
amount: | float |
currency: | string |
receiver_id: | JSON object |
payer: | JSON object |
currency: | string based on currencies code |
_links: |
array of object array of links of the advancement |
Example of Advancement Devolution
{
"id": 1,
"amount": 609.80,
"date": "2014-06-01T14:17:56Z",
"payer": {
"id": 1,
"name": "Company Inc.",
"type": "Organization",
"logo": [
{
"style": "original",
"url": "https://rexpense-uploads.s3.amazonaws.com/organization_logo/1/original/logo.png",
"expiration": "2014-06-27T20:31:43Z"
},
{
"style": "medium",
"url": "https://rexpense-uploads.s3.amazonaws.com/organization_logo/1/medium/logo.png",
"expiration": "2014-06-27T20:31:43Z"
},
{
"style": "thumb",
"url": "https://rexpense-uploads.s3.amazonaws.com/organization_logo/1/thumb/logo.png",
"expiration": "2014-06-27T20:31:43Z"
}
{
"style": "tiny",
"url": "https://rexpense-uploads.s3.amazonaws.com/organization_logo/1/tiny/logo.png",
"expiration": "2014-06-27T20:31:43Z"
}
]
},
"receiver": {
"id": 1,
"name": "John",
"type": "User",
"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"
}
]
},
"currency": "BRL",
"created_at": "2014-06-03T14:17:56Z",
"updated_at": "2014-06-03T14:17:56Z",
"_links": [
{
"rel": "create",
"method": "POST",
"href": "https://app.rexpense.com/api/v1/advancement_devolutions/"
}
]
}
Create an advancement devolutions
This request creates a new advancement devolution.
Important:
- The payer must have a relation with the receiver to create a new advancement devolution.
Parameters
payer: |
payer object attributes required
id: integer
type: string |
receiver: |
receiver object attributes required
id: integer
type: string |
amount: | float required |
date: | string required iso8601 format |
currency: | string based on currencies code |
Expired organization
If the organization is expired, it will return an 402 error.
Definition
POST https://app.rexpense.com/api/v1/advancement_devolutions
Example Request
$ curl -u $YOUR_API_TOKEN:X -X POST https://app.rexpense.com/api/v1/advancement_devolutions \ -H 'Accept: application/json' \ -H 'Content-type: application/json' \ -d '{"amount": 1000.00, "date": "2013-12-24", "receiver": {"id": 1, "type": "Organization"}}'
Response Example Success
HTTP 201 CREATED
{
"id": 1,
...
}
Response Example Failure
HTTP 422 Unprocessable Entity
{
"errors": {
"amount": ["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."
}
}