Api >

Service Portal REST API

Admin GETs Customer Lync Site
Given I am authenticated as Admin
and there is a Lync Gateway with id 200 and name Lync Gateway A
and there is a LyncSite with id 500 and name Lync Site
When I send /api/customers/K0002/lync/sites/500
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/lync/sites/500",
  "links": [{
    "rel": "gateway",
    "href": "/api/customers/K0002/lync/gateways/200"
  }],
  "data": [{
    "name": "serverName",
    "value": "Lync Gateway A"
  }, {
    "name": "domain",
    "value": "nfon.net"
  }, {
    "name": "description",
    "value": "Lync Site"
  }]
}
Customer GETs Lync Site
Given I am authenticated as customer K0002
and there is a Lync Gateway with id 200 and name Lync Gateway A
and there is a LyncSite with id 500 and name Lync Site
When I send /api/customers/K0002/lync/sites/500
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/lync/sites/500",
  "links": [],
  "data": [{
    "name": "serverName",
    "value": "Lync Gateway A"
  }, {
    "name": "domain",
    "value": "nfon.net"
  }, {
    "name": "description",
    "value": "Lync Site"
  }]
}
Get list of Inbound Trunk Numbers that use Lync Site
Given I am authenticated as customer K0002
and there is a LyncSite with id 500 and name Lync Site
and there is Inbound Trunk Number +48 (22) 1111-119
that belongs to Phone Extension with extension number 17
which this Lync Site is assigned to
and there is another Inbound Trunk Number +48 (22) 1234-6
that belongs to Phone Extension with extension number 302
which this Lync Site is assigned to
When I send /api/customers/K0002/lync/sites/500/used-in
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/lync/sites/500/used-in?_offset=0&_pagesize=16",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/targets/phone-extensions/17/inbound-trunk-numbers/0048.22.1111-119",
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 1111(0-9)"
    }, {
      "name": "extension",
      "value": "119"
    }]
  }, {
    "href": "/api/customers/K0002/targets/phone-extensions/302/inbound-trunk-numbers/0048.22.1234-6",
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 1234(0-9)"
    }, {
      "name": "extension",
      "value": "6"
    }]
  }]
}
`
Get list of filtered Inbound Trunk Numbers that use Lync Site
Given I am authenticated as customer K0002
and there is a LyncSite with id 500 and name Lync Site
and there is Inbound Trunk Number +48 (22) 1111-119
that belongs to Phone Extension with extension number 17
which this Lync Site is assigned to
and there is another Inbound Trunk Number +48 (22) 1234-6
that belongs to Phone Extension with extension number 302
which this Lync Site is assigned to
When I send /api/customers/K0002/lync/sites/500/used-in?_q=234
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/lync/sites/500/used-in?_offset=0&_pagesize=16&_q=234",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/targets/phone-extensions/302/inbound-trunk-numbers/0048.22.1234-6",
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 1234(0-9)"
    }, {
      "name": "extension",
      "value": "6"
    }]
  }]
}
`
Fail meaningfully when getting Lync Site for not existing Customer
Given I am authenticated as Admin
When I ask for lync sites of not existing Customer /api/customers/K0404/lync/sites/500
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 Lync Site for another Customer is forbidden
Given I am authenticated as customer K0002
When I ask for lync sites of another Customer /api/customers/K0003/lync/sites/500
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 [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator cannot GET Lync Site for Customer, that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/lync/sites/500
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 Lync Site for Customer, that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/lync/sites/500
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"
}