# Reasons
The reasons endpoint is useful to restrict sensitive transactions to certain situations only, in Ristecho cashier application and console, there is some transaction that requires a reason to be completed.
# The reason Object
# Sample
{
"id": "8df3433a",
"type": 1,
"name": "Voided Orders",
"name_localized": null,
"created_at": "2019-06-17 08:17:24",
"updated_at": "2019-06-17 08:51:34",
"deleted_at": null
}# Attributes
| Field | Type | Rule | Description |
|---|---|---|---|
id | string | Unique identifier for the reason. | |
name* | string | updatable | Name of the reason. |
name_localized | string | nullable updatable | Localized name of the reason. |
type* | integer | updatable | The Reason Type |
created_at | string | sortable | Time YYYY-MM-DD HH-MM-SS in UTC at which the object was created. |
updated_at | string | sortable | Time YYYY-MM-DD HH-MM-SS in UTC at which the object was updated. |
deleted_at | string | nullable | Time YYYY-MM-DD HH-MM-SS in UTC at which the object was deleted. |
# Types
| Type | Description |
|---|---|
| 1 | Order Void |
| 2 | Inventory |
| 3 | Drawer Operation |
# List reasons
GET /reasons
# Scope
general.read
# Filters
idnamename_localizedtypeupdated_afteris_deletedcreated_onupdated_ondeleted_on
# Response
{
"data": [
{
"id": "8df3433a",
"type": 1,
"name": "Voided Orders",
"name_localized": null,
"created_at": "2019-06-17 08:17:24",
"updated_at": "2019-06-17 08:51:34",
"deleted_at": null
}
]
}# Get reason
GET /reasons/{reasonId}
# Scope
general.read
# Response
{
"data": {
"id": "8df3433a",
"type": 1,
"name": "Voided Orders",
"name_localized": null,
"created_at": "2019-06-17 08:17:24",
"updated_at": "2019-06-17 08:51:34",
"deleted_at": null
}
}# Create reason
POST /reasons
# Scope
admin.write
# Request
{
"name": "Voided Order",
"name_localized":null,
"type": 1
}# Response
{
"data": {
"id": "8df3433a",
"type": 1,
"name": "Voided Orders",
"name_localized": null,
"created_at": "2019-06-17 08:17:24",
"updated_at": "2019-06-17 08:51:34",
"deleted_at": null
}
}# Update reason
PUT /reasons/{reasonId}
# Scope
admin.write
# Request
{
"name": "Voided Order",
"name_localized":null,
"type": 1
}# Response
{
"data": {
"id": "8df3433a",
"type": 1,
"name": "Voided Orders",
"name_localized": null,
"created_at": "2019-06-17 08:17:24",
"updated_at": "2019-06-17 08:51:34",
"deleted_at": null
}
}# Delete reason
DELETE /reasons/{reasonId}
# Scope
admin.write
The API will respond with 200 indicating that the reason has been deleted.
# Restore reason
PUT /reasons/{reasonId}/restore
# Scope
admin.write
The API will respond with 200 indicating that the reason has been restored.