api:employee:get-product
Table of Contents
API : Employee Product Get
Introduction
This request will return the PBX user product of a given user, if the user may access it. PBX user products can contain an “includedProducts”-property, allowing the PBX user product to act as a “package”, allowing the user to only pay one price for several products.
This endpoint also returns stats about how many of their includedProducts have been assigned to a services for this user.
VIEWER may access their own product, MANAGER and OWNER may access their employees' products. RESELLER may access their customers' employees products and ADMIN may all.
Request
| URL | https://api.telecomx.dk/employee/EMPLOYEE_ID/product | ||
|---|---|---|---|
| Method | GET | ||
| Access level | VIEWER, MANAGER or OWNER if product belongs to their parent reseller. RESELLER if product belongs to the reseller or is a master product. ADMIN. |
||
| Param | EMPLOYEE_ID | Id | Id of the employee to lookup product for. |
| Query | product | Id | [optional] Id of an alternative product to use in the lookup. Only available for RESELLER, RESELLER_ADMIN and ADMIN users. |
Query example
https://api.telecomx.dk/employee/123456780ABCDEF12345678/product
Response
| JSON object | ||
|---|---|---|
| _id | Id | Unique product id. |
| employee | Id | Id of the employee. |
| start | Date | The date from which the product can be used, null for no limit. |
| end | Date | The date from which the product can not be used anymore, null for no limit. |
| type | String | Type of product, is always PBX_USER |
| productCode | String | Product code, short name for accounting integration and for selecting when invoicing. |
| name | String | Product name. |
| unitType | String | The type of units this product is measured in: MIN, MB, UNITS, HOURS, KM, MONTHS. |
| recurrence | String | If product is recurring. Always MONTHLY. |
| recurrenceFullMonth | Boolean | If true the product must be invoiced for whole months, if false the product will only be invoiced for the fraction of the month that it has been active. |
| cost | Number | The cost of the product, pr. month if recurring. (ADMIN only). |
| wholesale | Number | The reseller price, pr. month if recurring. (RESELLER/ADMIN only). |
| price | Number | The customer price, pr. month if recurring. |
| reseller | Id | Id of the reseller the product belongs to and whose customers it can be applied to. Null if master product. |
| inheritFrom | Id | Id of the master product this product inherited from, null if product is a master product (RESELLER/ADMIN only). |
| inheritFromReseller | ObjectID | Id of reseller product that this product inherits from, null if master/reseller product. |
| inheritBy | Array | Id's of resellers who may inherit from this product, null if product may be inherited by any reseller (master products only). |
| applyByResellerOnly | Boolean | True if this product may only be used by a reseller (RESELLER/ADMIN only, customer cannot see these types of products). |
| PBX_USER properties | ||
| communicatorAccess | Boolean | Whether the user with this product has access to Communicator. Defaults to true. |
| recordingAccess | Boolean | Whether the product allows call recording. |
| extensionAccess | Boolean | Whether the product allows for PBX extensions. |
| sipPhoneAccess | Boolean | Whether the product allows for SIP phones. |
| includedProducts | Array | Array of products that are included in this PBX user product. Only products of type MVNO_RATEPLAN, PBX_EXTENSION, or PBX_SIP_PHONE are allowed, and only one type of each kind is allowed, meaning that you can ie. only have multiple MVNO_RATEPLANs if they are they the same kind. |
| includedProducts[]._id | ObjectID | Id of product that is included |
| includedProducts[].amount | Number | Amount of products of this kind that are included. |
| includedProducts[].used | Number | Usage of this product for the given employee. |
| includedProducts[].product | Object | Product object that contains the product included. See API : Product Get |
| includedProduct[].accounts | Array | IDs of accounts that use this product for the given employee. |
Note that properties holding no value may be omitted from the object.
Response examples
SIP_RATEPLAN
{ _id: '1234567890ABCDEF12345678', start: '2014-01-01T00:00:00.000Z', end: null, type: 'SIP_RATEPLAN', productCode: 'SR0123A', name: 'SIP account, flatrate DK', unitType: 'MONTHS', recurrence: 'MONTHLY' recurrenceFullMonth: true, cost: 150.00, wholesale: 180.00, price: 250.00, reseller: '1234567890ABCDEF12345678', inheritFrom: '1234567890ABCDEF1234578', applyByResellerOnly: false, communicatorAccess: true, recordingAccess: true, extensionAccess: true, sipPhoneAccess: true, includedProducts: [ { _id: '1234567890ABCDEF12345678', amount: 3, used: 2, accounts: [ '1234567890ABCDEF12345678', '1234567890ABCDEF12345678' ], product: { _id: '1234567890ABCDEF12345678', type: 'MVNO_RATEPLAN', price: 96, ... } }, { _id: '1234567890ABCDEF12345678', amount: 3, used: 2, accounts: [ '1234567890ABCDEF12345678', '1234567890ABCDEF12345678' ], product: { _id: '1234567890ABCDEF12345678', type: 'MVNO_RATEPLAN', price: 96, ... } }, ]
Errors
| Error code | Message | Description |
|---|---|---|
| 400 | bad_request | Id not found in request URI |
| 404 | not_found | Product not found |
| 403 | access_denied | Insufficient access level |
| 500 | internal_error | <Unspecified> |
api/employee/get-product.txt · Last modified: 2025/08/27 13:55 by Per Møller