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