Api >

Service Portal REST API

Admin should GET list of Customer Lync Options for Phone Extension
Test setup
Given there is a LyncSite with id 500 and name Lync Site
and there is a Phone Extension with extension number 201
and display name PhoneExtension
which has Inbound Trunk Number +48 (22) 1111-119
Given I am authenticated as Admin
and there is a Lync Option with id 134
When I send /api/customers/K0002/targets/phone-extensions/201/lync
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/phone-extensions/201/lync",
  "items": [{
    "href": "/api/customers/K0002/targets/phone-extensions/201/lync/134",
    "links": [{
      "rel": "lyncSite",
      "href": "/api/customers/K0002/lync/sites/500"
    }, {
      "rel": "inboundTrunkNumber",
      "href": "/api/customers/K0002/targets/phone-extensions/201/inbound-trunk-numbers/0048.22.1111-119"
    }],
    "data": [{
      "name": "extensionNumber",
      "value": "201"
    }, {
      "name": "inboundNumber",
      "value": "+48 (22) 1111-119"
    }, {
      "name": "lync",
      "value": "Lync Site"
    }]
  }]
}
Customer should GET list of Customer Lync Options for Phone Extension
Test setup
Given there is a LyncSite with id 500 and name Lync Site
and there is a Phone Extension with extension number 201
and display name PhoneExtension
which has Inbound Trunk Number +48 (22) 1111-119
Given I am authenticated as customer K0002
and there is a Lync Option with id 134
When I send /api/customers/K0002/targets/phone-extensions/201/lync
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/phone-extensions/201/lync",
  "items": [{
    "href": "/api/customers/K0002/targets/phone-extensions/201/lync/134",
    "links": [{
      "rel": "lyncSite",
      "href": "/api/customers/K0002/lync/sites/500"
    }, {
      "rel": "inboundTrunkNumber",
      "href": "/api/customers/K0002/targets/phone-extensions/201/inbound-trunk-numbers/0048.22.1111-119"
    }],
    "data": [{
      "name": "extensionNumber",
      "value": "201"
    }, {
      "name": "inboundNumber",
      "value": "+48 (22) 1111-119"
    }, {
      "name": "lync",
      "value": "Lync Site"
    }]
  }]
}
Fail meaningfully when getting list of Lync Options for not existing Customer
Test setup
Given there is a LyncSite with id 500 and name Lync Site
and there is a Phone Extension with extension number 201
and display name PhoneExtension
which has Inbound Trunk Number +48 (22) 1111-119
Given I am authenticated as Admin
When I ask for lync sites of not existing Customer /api/customers/K0404/targets/phone-extensions/201/lync
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 K0404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Getting list of Lync Options for another Customer is forbidden
Test setup
Given there is a LyncSite with id 500 and name Lync Site
and there is a Phone Extension with extension number 201
and display name PhoneExtension
which has Inbound Trunk Number +48 (22) 1111-119
Given I am authenticated as customer K0003
When I ask for lync sites of another Customer /api/customers/K0002/targets/phone-extensions/201/lync
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"
}
Should not get list of Lync Options for not existing Phone Extension
Test setup
Given there is a LyncSite with id 500 and name Lync Site
and there is a Phone Extension with extension number 201
and display name PhoneExtension
which has Inbound Trunk Number +48 (22) 1111-119
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/phone-extensions/345/lync
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Extension not found",
  "detail": "Extension with extension number 345 has not been found",
  "described_by": "http://api.nfon.net/probs/extension-not-found"
}
System Integrator cannot GET list of Lync Option for Customer, that does not belong to him
Test setup
Given there is a LyncSite with id 500 and name Lync Site
and there is a Phone Extension with extension number 201
and display name PhoneExtension
which has Inbound Trunk Number +48 (22) 1111-119
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/phone-extensions/201/lync
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 GET list of Lync Option for Customer, that does not belong to him
Test setup
Given there is a LyncSite with id 500 and name Lync Site
and there is a Phone Extension with extension number 201
and display name PhoneExtension
which has Inbound Trunk Number +48 (22) 1111-119
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/phone-extensions/201/lync
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"
}