Api >

Service Portal REST API

GET returns Lync Device data
Given I am authenticated as Customer K0002
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
which has been created at 2015-10-12 04:25 When I send /api/customers/K0002/devices/lync/1-48223333
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/devices/lync/1-48223333",
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/LYNC"
  }, {
    "rel": "extension",
    "href": "/api/customers/K0002/targets/phone-extensions/17"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/1"
  }, {
    "rel": "customer",
    "href": "/api/customers/K0002"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "1-48223333"
  }, {
    "name": "deviceType",
    "value": "LYNC"
  }, {
    "name": "deviceId",
    "value": "1-48223333"
  }, {
    "name": "extension",
    "value": "17"
  }, {
    "name": "created",
    "value": "2015-10-12 04:25"
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "site",
    "value": "Dummy site K0002"
  }, {
    "name": "deviceMasterCategory",
    "value": "LYNC"
  }, {
    "name": "deviceCategory",
    "value": "category"
  }]
}
Cannot read data for missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/devices/lync/1-48223333
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "described_by": "http://api.nfon.net/probs/customer-not-found",
  "title": "Customer not found",
  "detail": "Customer with identifier K0404 has not been found"
}
Cannot read data for missing Device
Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/lync/0404
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "title": "Device not found",
  "detail": "Device with unique identifier 0404 has not been found",
  "described_by": "http://api.nfon.net/probs/device-not-found"
}
System integrator can see sipUsername
Given I am authenticated as System Integrator S0002
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
which has been created at 2015-10-12 04:25 When I send /api/customers/K0002/devices/lync/1-48223333
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/devices/lync/1-48223333",
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/LYNC"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/1"
  }, {
    "rel": "customer",
    "href": "/api/customers/K0002"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "1-48223333"
  }, {
    "name": "deviceType",
    "value": "LYNC"
  }, {
    "name": "deviceId",
    "value": "1-48223333"
  }, {
    "name": "extension",
    "value": "17"
  }, {
    "name": "sipUsername",
    "value": "K0002"
  }, {
    "name": "created",
    "value": "2015-10-12 04:25"
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "site",
    "value": "Dummy site K0002"
  }, {
    "name": "deviceMasterCategory",
    "value": "LYNC"
  }, {
    "name": "deviceCategory",
    "value": "category"
  }]
}
Operator can see sipSecret
Given I am authenticated as Operator C0002
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 it has sipSecret set to kSIzxm76EE2
which has been created at 2015-10-12 04:25 When I send /api/customers/K0002/devices/lync/1-48223333
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/devices/lync/1-48223333",
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/LYNC"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/1"
  }, {
    "rel": "customer",
    "href": "/api/customers/K0002"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "1-48223333"
  }, {
    "name": "deviceType",
    "value": "LYNC"
  }, {
    "name": "deviceId",
    "value": "1-48223333"
  }, {
    "name": "extension",
    "value": "17"
  }, {
    "name": "sipUsername",
    "value": "K0002"
  }, {
    "name": "sipSecret",
    "value": "kSIzxm76EE2"
  }, {
    "name": "created",
    "value": "2015-10-12 04:25"
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "site",
    "value": "Dummy site K0002"
  }, {
    "name": "deviceMasterCategory",
    "value": "LYNC"
  }, {
    "name": "deviceCategory",
    "value": "category"
  }]
}
Customer cannot read another Customer device data
Given I am authenticated as customer K0003
When I send /api/customers/K0002/devices/lync/1-48223333
Then I should receive HTTP/1.1 403 Forbidden
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 read Lync device data of Customer, that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/devices/lync/1-48223333
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 read Lync device data of Customer, that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/devices/lync/1-48223333
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"
}