Api >

Service Portal REST API

GET retrieves list of available Phone Extension Devices
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 201
and there is another Phone Extension with extension number 402
and there are devices:
  • A standard device with Id ABCDEF012345 attached to Phone Extension 201
  • A standard device with Id ABCDEF012346 exists, which has been created at 2015-10-12 04:25
    with note: "test note for ABCDEF012346"
  • A XCAPI device with Id XCAPI1 exists, which has been created at 2015-10-12 04:25
    with note: "test note for XCAPI1
  • A XCAPI device with Id XCAPI2 exists, which is attached to Phone Extension 402
    which has been created at 2015-10-12 04:25
    with note: "test note for XCAPI2
  • A base device with Id BASE00000001
When I send /api/customers/K0002/targets/phone-extensions/available-devices
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/phone-extensions/available-devices?_offset=0&_pagesize=16&_orderBy=deviceId&_order=ASC",
  "offset": 0,
  "total": 3,
  "size": 3,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/devices/standard/ABCDEF012346",
    "links": [],
    "data": [{
      "name": "deviceType",
      "value": "standard"
    }, {
      "name": "deviceId",
      "value": "ABCDEF012346"
    }, {
      "name": "uniqueIdentifier",
      "value": "ABCDEF012346"
    }, {
      "name": "extension",
      "value": null
    }, {
      "name": "created",
      "value": "2015-10-12 04:25"
    }, {
      "name": "active",
      "value": true
    }, {
      "name": "deviceMasterCategory",
      "value": "STANDARD"
    }, {
      "name": "deviceCategory",
      "value": "category"
    }, {
      "name": "masterCategory",
      "value": "STANDARD"
    }, {
      "name": "category",
      "value": "category"
    }, {
      "name": "site",
      "value": "Dummy site K0002"
    }, {
      "name": "siteName",
      "value": "Dummy site K0002"
    }, {
      "name": "siteStreet",
      "value": ""
    }, {
      "name": "siteZip",
      "value": ""
    }, {
      "name": "siteCity",
      "value": ""
    }, {
      "name": "siteState",
      "value": null
    }, {
      "name": "siteCountry",
      "value": ""
    }, {
      "name": "siteSalesForceId",
      "value": "1"
    }, {
      "name": "note",
      "value": "test note for ABCDEF012346"
    }]
  }, {
    "href": "/api/customers/K0002/devices/xcapi/XCAPI1",
    "links": [],
    "data": [{
      "name": "deviceType",
      "value": "XCAPI1"
    }, {
      "name": "deviceId",
      "value": "XCAPI1"
    }, {
      "name": "uniqueIdentifier",
      "value": "XCAPI1"
    }, {
      "name": "extension",
      "value": null
    }, {
      "name": "created",
      "value": "2015-10-12 04:25"
    }, {
      "name": "active",
      "value": true
    }, {
      "name": "deviceMasterCategory",
      "value": "UNPROVISIONED_SIP"
    }, {
      "name": "deviceCategory",
      "value": "category"
    }, {
      "name": "masterCategory",
      "value": "UNPROVISIONED_SIP"
    }, {
      "name": "category",
      "value": "category"
    }, {
      "name": "site",
      "value": "Dummy site K0002"
    }, {
      "name": "siteName",
      "value": "Dummy site K0002"
    }, {
      "name": "siteStreet",
      "value": ""
    }, {
      "name": "siteZip",
      "value": ""
    }, {
      "name": "siteCity",
      "value": ""
    }, {
      "name": "siteState",
      "value": null
    }, {
      "name": "siteCountry",
      "value": ""
    }, {
      "name": "siteSalesForceId",
      "value": "1"
    }, {
      "name": "note",
      "value": "test note for XCAPI1"
    }]
  }, {
    "href": "/api/customers/K0002/devices/xcapi/XCAPI2",
    "links": [],
    "data": [{
      "name": "deviceType",
      "value": "XCAPI2"
    }, {
      "name": "deviceId",
      "value": "XCAPI2"
    }, {
      "name": "uniqueIdentifier",
      "value": "XCAPI2"
    }, {
      "name": "extension",
      "value": "402"
    }, {
      "name": "created",
      "value": "2015-10-12 04:25"
    }, {
      "name": "active",
      "value": true
    }, {
      "name": "deviceMasterCategory",
      "value": "UNPROVISIONED_SIP"
    }, {
      "name": "deviceCategory",
      "value": "category"
    }, {
      "name": "masterCategory",
      "value": "UNPROVISIONED_SIP"
    }, {
      "name": "category",
      "value": "category"
    }, {
      "name": "site",
      "value": "Dummy site K0002"
    }, {
      "name": "siteName",
      "value": "Dummy site K0002"
    }, {
      "name": "siteStreet",
      "value": ""
    }, {
      "name": "siteZip",
      "value": ""
    }, {
      "name": "siteCity",
      "value": ""
    }, {
      "name": "siteState",
      "value": null
    }, {
      "name": "siteCountry",
      "value": ""
    }, {
      "name": "siteSalesForceId",
      "value": "1"
    }, {
      "name": "note",
      "value": "test note for XCAPI2"
    }]
  }]
}
GET retrieves filtered list of available Phone Extension Devices
Filtering is done on field:
  • uniqueIdentifier
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 201
and there are devices:
  • A standard device with Id ABCDEF012345 attached to Phone Extension 201
  • A standard device with ID ABCDEF012346 already exists,
    created on 2015-10-12 04:25
    with note: test note for ABCDEF012346
  • A XCAPI device with ID XCAPI1 already exists,
    created on 2015-10-12 04:25
  • base device with Id BASE00000001
When I send /api/customers/K0002/targets/phone-extensions/available-devices?_q=123
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/phone-extensions/available-devices?_offset=0&_pagesize=16&_q=123&_orderBy=deviceId&_order=ASC",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/devices/standard/ABCDEF012346",
    "links": [],
    "data": [{
      "name": "deviceType",
      "value": "standard"
    }, {
      "name": "deviceId",
      "value": "ABCDEF012346"
    }, {
      "name": "uniqueIdentifier",
      "value": "ABCDEF012346"
    }, {
      "name": "extension",
      "value": null
    }, {
      "name": "created",
      "value": "2015-10-12 04:25"
    }, {
      "name": "active",
      "value": true
    }, {
      "name": "deviceMasterCategory",
      "value": "STANDARD"
    }, {
      "name": "deviceCategory",
      "value": "category"
    }, {
      "name": "masterCategory",
      "value": "STANDARD"
    }, {
      "name": "category",
      "value": "category"
    }, {
      "name": "site",
      "value": "Dummy site K0002"
    }, {
      "name": "siteName",
      "value": "Dummy site K0002"
    }, {
      "name": "siteStreet",
      "value": ""
    }, {
      "name": "siteZip",
      "value": ""
    }, {
      "name": "siteCity",
      "value": ""
    }, {
      "name": "siteState",
      "value": null
    }, {
      "name": "siteCountry",
      "value": ""
    }, {
      "name": "siteSalesForceId",
      "value": "1"
    }, {
      "name": "note",
      "value": "test note for ABCDEF012346"
    }]
  }]
}
Cannot GET list of available Phone Extension Devices for missing Customer
Given I am authenticated as admin
When I send /api/customers/K404/targets/phone-extensions/available-devices
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Customer not found",
  "detail": "Customer with identifier K404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Customer cannot GET list of available Phone Extension Devices for not his Phone Extension
Given there is a Phone Extension with extension number 201
and I am authenticated as customer K0003
When I send /api/customers/K0002/targets/phone-extensions/available-devices
Then I should receive HTTP/1.1 403 Forbidden
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator cannot access Available Phone Extension Devices of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/phone-extensions/available-devices
Then I should receive HTTP/1.1 403 Forbidden
with following body
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Operator cannot access Phone Extensions of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/phone-extensions
Then I should receive HTTP/1.1 403 Forbidden
with following body
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}