User Tools

Site Tools


api:employee:get-product

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, MANAGER and OWNER may access the product of any employee of their own customer. RESELLER may access the products of employees of customers in their reseller tree. RESELLER_ADMIN and ADMIN may access all.

Request

URL https://api.telecomx.dk/employee/EMPLOYEE_ID/product
Method GET
Access level VIEWER, MANAGER or OWNER if the employee belongs to their own customer.
RESELLER if the employee belongs to a customer in their reseller tree.
RESELLER_ADMIN or 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/650000000000000000000102/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, RESELLER_ADMIN or 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.
applyByResellerOnly Boolean True if this product may only be applied to accounts by the reseller, not by the customer itself.
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 The included product, with cost hidden below ADMIN and wholesale hidden below RESELLER, and without its sms, mms, override, data or socs properties.
includedProducts[].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

PBX_USER

{
  "_id": "650000000000000000000101",
  "employee": "650000000000000000000102",
  "start": "2014-01-01T00:00:00.000Z",
  "end": null,
  "type": "PBX_USER",
  "productCode": "PBXUSER02",
  "name": "Small user package",
  "unitType": "MONTHS",
  "recurrence": "MONTHLY",
  "recurrenceFullMonth": true,
  "wholesale": 20.00,
  "price": 25.00,
  "reseller": "650000000000000000000103",
  "applyByResellerOnly": false,
  "communicatorAccess": true,
  "recordingAccess": true,
  "extensionAccess": true,
  "sipPhoneAccess": true,
  "includedProducts": [
    {
      "_id": "650000000000000000000104",
      "amount": 3,
      "used": 2,
      "accounts": [
        "650000000000000000000105",
        "650000000000000000000106"
      ],
      "product": {
        "_id": "650000000000000000000104",
        "type": "MVNO_RATEPLAN",
        "price": 96
      }
    }
  ]
}

Errors

Error code Message Description
404 employee Not found
404 product Not found
403 access_denied Insufficient access level
500 internal_error <Unspecified>
api/employee/get-product.txt · Last modified: by Mikkel Meerwaldt Jørgensen

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki