post https://api.splio.com/loyalty/v1/rewards
Create a new reward that can be given to members.
Error cases
Mandatory field is not present (400)
{
"error_key": "ExternalID",
"error": "",
"error_description": "ExternalID is missing"
}
{
"status": 400,
"errors": [
{
"error_key": "name",
"error": "is_blank",
"error_description": "This value should not be blank."
}
]
}
Malformatted value - ex: boolean as string (400)
Generic error for all fields and custom fields values types
{
"status": 400,
"errors": [
{
"error_key": "limited",
"error": "wrong_type",
"error_description": "This value should be of type bool."
},
{
"error_key": "custom_fields[0].value",
"error": "wrong_type",
"error_description": "This value should be of type string."
}
]
}
Reward external_id already exists (400)
{
"status": 400,
"errors": [
{
"error_key": "external_id",
"error": "wrong_value",
"error_description": "Another reward has ext id hehhe."
}
]
}
Limited set to false, auto_generated set to false (400)
{
"error_key": "limited",
"error": "unlimited_non_autogenerated",
"error_description": "reward cannot be unlimited and non-autogenerated"
}
Max_attribution_count unset for limited reward (400)
{
"error_key": "max_attribution_count",
"error": "invalid_max_attribution_count",
"error_description": "max_attribution_count cannot be set to 0 if the reward is limited"
}
Max_attribution_count is set for a non_autogenerated reward (400)
{
"error_key": "max_attribution_count",
"error": "invalid_max_attribution_count",
"error_description": "max_attribution_count cannot be set if the reward is non-autogenerated. the max_attribution_count is related to the upload of instances"
}
Max_attribution_count is set for an unlimited reward (400)
{
"error_key": "max_attribution_count",
"error": "invalid_max_attribution_count",
"error_description": "you cannot have a max attribution count if the reward is unlimited"
}
Monetary set to true, monetary details missing (400)
{
"status": 400,
"errors": [
{
"error_key": "monetary",
"error": "invalid_monetary_data",
"error_description": "monetary_type is missing"
},
{
"error_key": "monetary",
"error": "invalid_monetary_data",
"error_description": "monetary_value is missing"
}
]
}
Forced_validity set to false, forced_validity dates specified (400)
{
"status": 400,
"errors": [
{
"error_key": "forced_validity_start",
"error": "invalid_validity_data",
"error_description": "you have to enable forced_validity to set a forced_validity_start."
},
{
"error_key": "forced_validity_end",
"error": "invalid_validity_data",
"error_description": "you have to enable forced_validity to set a forced_validity_end."
}
]
}