Api >

Service Portal REST API

GET retrieves existing devices
Given I am authenticated as admin
  • there is a Base Device Type with name base
    and there is Base Device with external identifier 00123
  • there is a Extended Base Device Type with name extended_base
    and there is Extended Base Device with external identifier 00777
  • and there is a XCAPI Device with ID xcapi123
  • and there is an UnprovisionedSip Device Type with name unprovisioned_sip
    and there is a Unprovisioned Sip Device with ID device123
  • and there is a Phone Extension with extension number 17
    and there is a Trunk with numbers +48 (22) 33-65
    and there is an Inbound Trunk Number with extension 33
    and it is assigned to phone extension
    and there is a Lync Option with id 134
    and there is a Lync Softphone Device attached
  • and there is a Standard Device Type with name standard
    and there is a Standard Device with ID 123456789abc
  • and there is a Handset Device Type with name handset
    and there is a Handset Device with ID ABCDEF012345-Port0
  • and there is a Operator Panel Device Type with name operator
    and there is a Operator Panel Device with ID operatorDevice
  • and there is a Media Gateway Device with ID 123AAAAAAAAA
When I send /api/devices
Then I should receive HTTP/1.1 200 OK
with following body
{
  "href": "/api/devices?_offset=0&_pagesize=16",
  "offset": 0,
  "total": 9,
  "size": 9,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/devices/base/00123",
    "links": [{
      "rel": "customer",
      "href": "/api/customers/K0002"
    }, {
      "rel": "deviceType",
      "href": "/api/device-types/base"
    }],
    "data": [{
      "name": "deviceId",
      "value": "00123"
    }, {
      "name": "customer",
      "value": "K0002"
    }, {
      "name": "deviceType",
      "value": "base"
    }, {
      "name": "extension",
      "value": null
    }]
  }, {
    "href": "/api/customers/K0002/devices/base/00777",
    "links": [{
      "rel": "customer",
      "href": "/api/customers/K0002"
    }, {
      "rel": "deviceType",
      "href": "/api/device-types/extended_base"
    }],
    "data": [{
      "name": "deviceId",
      "value": "00777"
    }, {
      "name": "customer",
      "value": "K0002"
    }, {
      "name": "deviceType",
      "value": "extended_base"
    }, {
      "name": "extension",
      "value": null
    }]
  }, {
    "href": "/api/customers/K0002/devices/xcapi/xcapi123",
    "links": [{
      "rel": "customer",
      "href": "/api/customers/K0002"
    }, {
      "rel": "deviceType",
      "href": "/api/device-types/XCAPI"
    }],
    "data": [{
      "name": "deviceId",
      "value": "xcapi123"
    }, {
      "name": "customer",
      "value": "K0002"
    }, {
      "name": "deviceType",
      "value": "XCAPI"
    }, {
      "name": "extension",
      "value": null
    }]
  }, {
    "href": "/api/customers/K0002/devices/unprovisioned-sip/device123",
    "links": [{
      "rel": "customer",
      "href": "/api/customers/K0002"
    }, {
      "rel": "deviceType",
      "href": "/api/device-types/unprovisioned_sip"
    }],
    "data": [{
      "name": "deviceId",
      "value": "device123"
    }, {
      "name": "customer",
      "value": "K0002"
    }, {
      "name": "deviceType",
      "value": "unprovisioned_sip"
    }, {
      "name": "extension",
      "value": null
    }]
  }, {
    "href": "/api/customers/K0002/devices/lync/1-48223333",
    "links": [{
      "rel": "customer",
      "href": "/api/customers/K0002"
    }, {
      "rel": "deviceType",
      "href": "/api/device-types/LYNC"
    }],
    "data": [{
      "name": "deviceId",
      "value": "1-48223333"
    }, {
      "name": "customer",
      "value": "K0002"
    }, {
      "name": "deviceType",
      "value": "LYNC"
    }, {
      "name": "extension",
      "value": "17"
    }]
  }, {
    "href": "/api/customers/K0002/devices/standard/123456789abc",
    "links": [{
      "rel": "customer",
      "href": "/api/customers/K0002"
    }, {
      "rel": "deviceType",
      "href": "/api/device-types/standard"
    }],
    "data": [{
      "name": "deviceId",
      "value": "123456789abc"
    }, {
      "name": "customer",
      "value": "K0002"
    }, {
      "name": "deviceType",
      "value": "standard"
    }, {
      "name": "extension",
      "value": null
    }]
  }, {
    "href": "/api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0",
    "links": [{
      "rel": "customer",
      "href": "/api/customers/K0002"
    }, {
      "rel": "deviceType",
      "href": "/api/device-types/handset"
    }],
    "data": [{
      "name": "deviceId",
      "value": "ABCDEF012345-Port0"
    }, {
      "name": "customer",
      "value": "K0002"
    }, {
      "name": "deviceType",
      "value": "handset"
    }, {
      "name": "extension",
      "value": null
    }]
  }, {
    "href": "/api/customers/K0002/devices/operator-panel/operatorDevice",
    "links": [{
      "rel": "customer",
      "href": "/api/customers/K0002"
    }, {
      "rel": "deviceType",
      "href": "/api/device-types/operator"
    }],
    "data": [{
      "name": "deviceId",
      "value": "operatorDevice"
    }, {
      "name": "customer",
      "value": "K0002"
    }, {
      "name": "deviceType",
      "value": "operator"
    }, {
      "name": "extension",
      "value": null
    }]
  }, {
    "href": "/api/customers/K0002/devices/media-gateway/123AAAAAAAAA",
    "links": [{
      "rel": "customer",
      "href": "/api/customers/K0002"
    }, {
      "rel": "deviceType",
      "href": "/api/device-types/MEDIA_GATEWAY"
    }],
    "data": [{
      "name": "deviceId",
      "value": "123AAAAAAAAA"
    }, {
      "name": "customer",
      "value": "K0002"
    }, {
      "name": "deviceType",
      "value": "MEDIA_GATEWAY"
    }, {
      "name": "extension",
      "value": null
    }]
  }]
}
GET retrieves available Timezones
Given I am authenticated as Customer K0002
When I send /api/devices
Then I should receive HTTP/1.1 403 Forbidden
with following body
{
  "detail": "Required role is missing",
  "title": "Access forbidden",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}