User's Preferences
This section describes the API of the user's preferences. An user can set his preferences and these preferences are: locale and timezone.
Parameters
id: | integer |
locale: | string 'en' or 'pt' |
timezone: | string |
mention_name: | string |
default_currency: | string based on currencies code |
avatar: |
array of object array of styles and URL of the avatar |
_links: | array of object array of links of the user's preferences |
Example User's Preferences
Show preferences
Returns the detailed information of the user's preferences.
Definition
GET https://app.rexpense.com/api/v1/preferences
Example Request
$ curl -u $YOUR_API_TOKEN:X -X GET https://app.rexpense.com/api/v1/preferences \ -H 'Accept: application/json' \ -H 'Content-type: application/json'
Response Example
HTTP 200 OK
Update preferences
There are two ways to update the user's preferences: 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 user's preferences.
Parameters
locale: | string 'en' or 'pt' |
timezone: | string |
mention_name: | string |
default_currency: | string based on currencies code |
_links: | array of object array of links of the user's preferences |
To update the user avatar, you have to send the avatar
parameter. This parameter is a JSON object with the following information:
Parameters
file: | string |
_destroy: | boolean |
The file parameter must be an URL of the avatar. This URL may be achieve following the steps in Uploads section.
To remove the avatar, you have to pass the _destroy
parameter with value true
.
Definition
PUT/PATCH https://app.rexpense.com/api/v1/preferences
Example Request
$ curl -u $YOUR_API_TOKEN:X -X PATCH https://app.rexpense.com/api/v1/preferences \ -H 'Accept: application/json' \ -H 'Content-type: application/json' \ -d '{"locale":"en"}'
Response Example Success
HTTP 200 OK
Response Example Failure
HTTP 422 Unprocessable Entity