Table of Contents

API : Search

Introduction

The search function is the primary function for finding anything. It will search through customers, employees, SIP accounts, MVNO accounts, internet accounts, ongoing portings, TCE boxes, IPTV devices, DNS domains, SIP phones and network devices. Not all data is exposed to the search, but all primary data in any of the search sections is available.

Request

URL https://api.telecomx.dk/search
Method GET (preferred) or POST
Access level VIEWER, MANAGER, OWNER, RESELLER, RESELLER_ADMIN or ADMIN. Customer results are only returned for RESELLER, RESELLER_ADMIN and ADMIN users.
Query query What to search for, names, addresses, numbers, codes etc. Min. 3 characters, and at least 4 after normalisation (trimming, lowercasing and whitespace collapsing). Two prefixes are supported: iptv <query> prioritises IPTV devices in the result, and rx:<regex> searches with a raw regular expression (no normalisation, min. 3 characters).
offset [optional] If paging through a larger set of results, this is the index of the first item to return, default 0.
limit [optional] The number of items to return, default 100, max. 100
includeDeleted [optional] True to also include deleted customers in the search
includeSubResellers [optional] True to also include customers of your sub resellers in the search (only honored for users with access level RESELLER).
Body JSON object (only if method is POST) - see query section above for arguments

Query example

https://api.telecomx.dk/search?query=customername&offset=0&limit=100&includeDeleted=false&includeSubResellers=true

Response

JSON object
offset Index of the first returned item in the total search result, 0-based
limit Number of items to return (actual count may be less if offset + limit > total)
total Total number of items in the search result. Useful for paging through a large result set
results Array of result objects - see description below. The results are ordered according to how they scored in the search.

The result object

Each result object has a set of common fields:

Key Type Description Example
score Number A number that specifies how high a score the result got during the search. The higher the value, the more likely the item is to be what the user is searching for. Used to order results so that the most relevant items gets shown first. 51
type String The type of this item. Can be 'customer', 'employee', 'sip', 'mvno', 'internet', 'porting', 'tce', 'iptvdevice', 'dns', 'sipphone', 'networkdevice'. Customer results are only returned for RESELLER, RESELLER_ADMIN and ADMIN users. 'sip'
id Id Id of the matched item 650000000000000000000001
url String Url for accessing the item in the api. Per type: /customer/<id>, /employee/<id>, /sip/<id>, /mvno/<id>, /internet/account/<id>, /porting/<id>, /tce/<id>, /dns/<domain>, /pbx/sipphone/<id>, /network/<id>; IPTV devices link to /flexcare/device/stb/<id> or /flexcare/device/android/<id> for customers with the FLEXCARE feature, otherwise /iptv/stb/<id> or /iptv/app/<id>. /sip/650000000000000000000001
customer Id Id of the customer that the item belongs to 650000000000000000000002
customerName String Name of the customer that the item belongs to Northwind Industries
customerFeatures Array List of features in the TelecomX platform that the customer has access to - see Customer Update for the feature list. ['CUSTOMER','SIP','MVNO']
customerIntegrations Array The customer's integrations - see Customer Get.
parentReseller Id Id of the customer's parent reseller. 650000000000000000000003
label String A label that describes the item. Customer/employee: the name. Sip: the trunk name. Mvno: the number. Internet: the circuit id. Porting: the number(s). Tce: the box id. Dns: the domain. Sipphone: brand, model and MAC address. Networkdevice and iptvdevice: the device name. Hans Christian Andersen
values Object A sub object of additional information about the matched item in a key/value format. See the possibilities below.

Result value examples

Type Key Value example
customer phoneNumber 12345678
emailAddress info@example.dk
vatNumber DK12345678
address Byvej 17, 2500 Valby
employee title Manager
department Sales
emailAddress employee@example.dk
smsNumber 33333333
sip active true
numbers 70101010, 44450000-99
product SIP account, flatrate DK
pbx false
status ON (current status, e.g. ON, OFF or BUSY - always ON for PBX accounts)
mvno active true
sim 45891234567890123456
product Free voice 25GB
pbx false
status ON (current status, e.g. ON, OFF or BUSY - always ON for PBX accounts)
internet state ACTIVE
address Byvej 17, 2500 Valby
product Fiber 100Mbit
ipAddress 203.0.113.123
status ON
porting numberType SIP
statusStage IN_ORDERED
statusDate 2014-01-05T12:34:56.000Z
requestedDate 2014-01-01T12:34:56.000Z
portingDate 2014-01-10T12:34:56.000Z
currentSimNumber 45891234567890123456 (MVNO portings only)
tce ipAddress 192.168.10.23
publicIp 203.0.113.124
status ON
dns (no values) Dns results have an empty values object
sipphone ipAddress 192.168.10.24
publicIp 203.0.113.125
status ON
extension 101 Reception
networkdevice macAddress AABBCCDDEEFF ('n/a' when absent)
serialNumber S123456789 ('n/a' when absent)
deviceId DEV-1234 ('n/a' when absent)
status ON
iptvdevice active true
ipAddress 192.168.10.25 ('n/a' when absent)
publicIp 203.0.113.126 ('n/a' when absent)
status ON (ON if the device communicated within the last 70 seconds, else OFF)
type STB
deviceId STB-1234
serial S987654321 ('n/a' when absent)
technicalRoomNumber 214 ('n/a' when absent)
usedRoomNumber 214A ('n/a' when absent)
lanMac AABBCCDDEE01 (non-STB devices only, 'n/a' when absent)
wifiMac AABBCCDDEE02 (non-STB devices only, 'n/a' when absent)

Example

{
  "offset": 0,
  "limit": 100,
  "total": 354,
  "results": [
    {
      "score": 100,
      "type": "customer",
      "id": "650000000000000000000002",
      "url": "/customer/650000000000000000000002",
      "customer": "650000000000000000000002",
      "customerName": "Northwind Industries",
      "customerFeatures": ["CUSTOMER", "SIP", "MVNO"],
      "customerIntegrations": [],
      "parentReseller": "650000000000000000000003",
      "label": "Northwind Industries",
      "values": {
        "phoneNumber": "12345678",
        "emailAddress": "info@example.dk",
        "vatNumber": "DK12345678",
        "address": "Byvej 17, 2500 Valby"
      }
    },
    {
      "score": 40,
      "type": "sip",
      "id": "650000000000000000000001",
      "url": "/sip/650000000000000000000001",
      "customer": "650000000000000000000002",
      "customerName": "Northwind Industries",
      "customerFeatures": ["CUSTOMER", "SIP", "MVNO"],
      "customerIntegrations": [],
      "parentReseller": "650000000000000000000003",
      "label": "Primary trunk Copenhagen",
      "values": {
        "active": true,
        "numbers": "70101010, 44450000-99",
        "product": "SIP account, flatrate DK",
        "pbx": false,
        "status": "ON"
      }
    }
  ]
}

Errors

Error code Message Description
403 access_denied A minimum access level of 'VIEWER' required
422 query The query is too short (min. 3 characters, and at least 4 after normalisation). Note: the error message field is currently empty on the wire.
422 query The rx: regular expression could not be parsed. Note: the error message field is currently empty on the wire.
500 internal_error <Unspecified>