Overview
Table of Contents
Credentials in QReserve are records associated with users within a site or a portal that may or may not have an expiry date. Credentials can be used to restrict access to resources, filter users for messaging, or be used in reservation and rate scripts to make decisions.
Note: Credentials were historically referred to as
trainingwithin QReserve. For backwards compatibility, many API names still refer totraininginstead ofcredentials.
Credential Types
A credential type is a class of records a person can earn. For example, it could be a specific type of training, a membership, or a status. Each credential record is a record of a particular credential type.
Data Structure
{
"training_id": "string",
"active": boolean,
"name": "string",
"description": "string",
"site_id": "string" | null,
"site_name": "string" | null,
"portal_id": "string" | null,
"portal_name": "string" | null,
"duration_default": integer | null,
"duration_default_unit": "years" | "months" | "weeks" | "days" | "minutes" | "seconds" | null,
"site_training_id": "string",
"months": integer | null,
"reservables": [
"RESOURCE_ID" // Resource IDs requiring this credential
],
"silent": boolean,
"user_name_affix": "string" | null,
"training_records": [
// Credential record objects (only if requested)
]
}
Credential Records
A credential record is an instance of a credential type for a user in your site. A record will be considered valid from the moment it is created up until its (optional) expiry date. Additional information can be stored in the meta_data JSON field that is accessible in sneq scripts.
Data Structure
{
"user_training_record_id": "string",
"training_id": "string",
"user": {
// User object
},
"portal_id": "string" | null,
"portal_name": "string" | null,
"site_id": "string" | null,
"site_name": "string" | null,
"added_by": {
// User object
},
"created": "UTC date string",
"days_left": integer, // 999999999 for a record with no expiry
"earned_on": "string", // Typically date but supports arbitrary text
"expired": boolean, // True when now() > expires
"expires": "date string" | null,
"site_training_id": "string",
"site_user_training_id": "string",
"name": "string", // Credential Type name
"note": "string",
"performed_by": "string",
"silent": boolean,
"meta_data": JSON object | null
}