Table of Contents
API : Employee Reset Pincode
Introduction
This request generates a new random 6 digit pincode for an employee and sends it to the employee - by SMS to the employee's smsNumber, or by e-mail to the employee's emailAddress when no SMS number is registered. The pincode opens the employee's voicemail, hotdesking etc.
Only the employee self may choose their own pincode (see Update), so this is how a manager has a forgotten or leaked pincode replaced. The new pincode is never returned by this request - the user making it does not learn it - and the old pincode stops working at once.
If the employee has neither an SMS number nor an e-mail address, the request is refused and the pincode is left unchanged. An employee with noEmail counts as having no e-mail address, as its emailAddress holds a synthesized username.
The action is written to the employee's change log.
Request
| URL | https://api.telecomx.dk/employee/EMPLOYEE_ID/pincode/reset | |
|---|---|---|
| Method | POST | |
| Header | Authorization | Bearer token |
| Access level | MANAGER or OWNER if the user belongs to the customer of the employee. RESELLER if the customer belongs to the reseller. RESELLER_ADMIN and ADMIN. The customer must have PBX. |
|
| Param | EMPLOYEE_ID | Id of the employee (24 hex-char string) |
Request example
POST https://api.telecomx.dk/employee/1234567890ABCDEF12345678/pincode/reset
Response
| Json object | ||
|---|---|---|
| success | Boolean | True on success. |
| method | String | How the new pincode was sent: SMS or EMAIL. |
Example
{ success: true, method: 'SMS' }
The SMS is sent in the employee's language with the reseller's name as sender, e.g. Din nye pinkode til telefonsvarer og hotdesk er 123456 - den gamle kode er nu ugyldig. The e-mail uses the employeePinCodeReset.html template and names the user who ordered the new pincode.
If sending fails (e.g. the SMS provider is down), the old pincode is put back and the request fails with 500 - it can simply be repeated. Two resets of the same employee at the same time are not both carried out: the pincode is only replaced if it is still the one the request started from, so the second reset is refused with 409 before anything is sent.
Errors
| Error code | Message | Description |
|---|---|---|
| 403 | access_denied | A minimum access level of 'MANAGER' is required, or the user has no write access to the customer of the employee |
| 404 | not_found | Employee not found |
| 409 | pinCode | The customer has no PBX, so the employee has no use for a pincode |
| 409 | pinCode | The pincode was changed while a new one was being generated - try again |
| 422 | id | Invalid ObjectId |
| 422 | pinCode | The employee has neither an SMS number nor an e-mail address to send a new pincode to |