Organizations
This section describes the API of the organization resource. Organizations represent a group of users which have expenses. Generally, organizations represent the company or corporation the group of users belong to.
Parameters
id: | integer |
name: | string |
restricted_tags: | boolean |
expired: | boolean |
members_count: | integer |
created_at: | string |
updated_at: | string |
members_count: | integer |
identifier_document: | string |
default_liquidation_kind: | string |
logo: |
array of object array of styles and URL of the logo |
_links: |
array of object array of links of the organization |
Example Organization
List all organizations
Retrieve all organizations that a user is member of. It will return a JSON
containing the name of the resource
with an array of the objects requested. The fields of the organizations can be found in the Organization section.
Parameters
page: | integer |
per_page: | integer |
Definition
GET https://app.rexpense.com/api/v1/organizations
Example Request
$ curl -u $YOUR_API_TOKEN:X -X GET https://app.rexpense.com/api/v1/organizations \
-H 'Accept: application/json' \
-H 'Content-type: application/json'
Response Example
Show an organization
This request return the detailed representation of the organization.
Definition
GET https://app.rexpense.com/api/v1/organizations/:id
Example Request
$ curl -u $YOUR_API_TOKEN:X -X POST https://app.rexpense.com/api/v1/organizations/:id \ -H 'Accept: application/json' \ -H 'Content-type: application/json'
Response Example Success
HTTP 200 OK
Update an organization
There are two ways to update an organization: partially or fully. If you'd like to change just one or
a few attributes, you have to use the HTTP method PATCH
. If you use the HTTP method PUT
, you'll have to
pass all attributes of the organization. This behaviour is the same for all resources in the Rexpense API.
Parameters
name: | string required |
file: | string |
_destroy: | boolean |
To update an existing organization logo, you have to provide the parameter file
. This parameter
must be an URL of the logo. This URL may be achieve following the steps
in Uploads section.
To remove the logo, you have to pass the _destroy
parameter with value true
.
Definition
PUT/PATCH https://app.rexpense.com/api/v1/organizations/:id
Example Request
$ curl -u $YOUR_API_TOKEN:X -X PATCH https://app.rexpense.com/api/v1/organizations/:id \ -H 'Accept: application/json' \ -H 'Content-type: application/json' \ -d '{"name":"My Organization"}'
Response Example Success
HTTP 200 OK
Response Example Failure
HTTP 422 Unprocessable Entity
Destroy an organization
When you destroy an organization, it will destroy all expenses attached to it. So, be carefull doing do that!
Definition
DELETE https://app.rexpense.com/api/v1/organizations/:id
Example Request
$ curl -u $YOUR_API_TOKEN:X -X DELETE https://app.rexpense.com/api/v1/organizations/:id \ -H 'Accept: application/json' \ -H 'Content-type: application/json'
Response Example
HTTP 204 NO CONTENT