GET /api/rewards/:id
Show reward details


PUT /api/rewards/:id/approve
Approve reward. If reward params are present, updates the reward before approval

Approves expense. If params of the expense are present, updates the expense before approval


POST /api/rewards/:id/disapprove
Disapprove reward

Disapprove expense with a comment

Params

Param name Description
comment
optional

The reason of expense disapproval; will be displayed to user

Validations:

  • Must be a String


GET /api/rewards/:id/conditional_values
Get values for the conditional fields of the reward


GET /api/rewards
Get the list of rewards

Get the list of all rewards accessible by the current user. Can be paginated and/or filtered by reward state

Params

Param name Description
archived_after
optional

Return only rewards accounted on and after the supplied date. Date format: YYYYMMDD (example: 20180702)

Validations:

  • Must be a String

page
optional

Return only one page of rewards. Default per-page is 10

Validations:

  • Must be a Integer

per_page
optional

Number of rewards returned per page. Works only in combination with “page” param. Default value is 10

Validations:

  • Must be a Integer

state
optional

Validations:

  • Must be one of: draft, reviewing, unapproved, queue, accounting.


POST /api/rewards
Create reward

Creates new reward

Params

Param name Description
draft
optional

Whether created reward should be in draft state. If the value of this param is 1, reward will be saved as draft and will not be validated; otherwise, it will be either in reviewing or queue state (depending on whether its user has approvers or not).

Validations:

  • Must be a Integer

user_id
optional

Reward’s user, optional, defaults to current user. Must be one of the current company users

Validations:

  • Must be a Integer

reward
required

Reward hash

Validations:

  • Must be a Hash

reward[description]
required

Reward description

Validations:

  • Must be a String

reward[date]
required

Reward date

Validations:

  • Must be a String

reward[cost_center_ids]
optional , nil allowed

Validations:

  • Must be an array of Integer

reward[reward_type_id]
required

Reward type ID, IDs can be fetched from GET /api/reward_types

Validations:

  • Must be a Integer

reward[tax_card_id]
optional , nil allowed

User’s tax card ID

Validations:

  • Must be a Integer

reward[cost]
required

Reward cost, can be either reward type cost or custom (for non-fixed price reward types)

Validations:

  • Must be a Float

reward[tax_percentage]
required

Tax percentage, should be less than 1, e.g. 0.35 for 35%

Validations:

  • Must be a Float

reward[conditional_values_attributes]
optional , nil allowed

Values for conditional fields of reward type’s expense account (optional)

Validations:

  • Must be an Array of nested elements

reward[conditional_values_attributes][field_id]
optional , nil allowed

ID of expense account’s conditional field

Validations:

  • Must be a Integer

reward[conditional_values_attributes][field_type]
optional , nil allowed

Field type: Account::ConditionalField or ExpenseCategory::ConditionalField

Validations:

  • Must be a String

reward[conditional_values_attributes][value]
optional , nil allowed

Conditional field’s value

Validations:

  • Must be a String