Api >

Service Portal REST API

GET retrieves requested Time Control Service
Given I am authenticated as customer K0002
And there is a Time Control Service
  • with name time control name
  • with service number 345
  • and extension number 576
When I send /api/customers/K0002/targets/time-control-services/345
Then I should receive HTTP/1.1 200 OK
And Content-Type header should be application/vnd.collection.next+json
with following body:
{
  "href": "/api/customers/K0002/targets/time-control-services/345",
  "links": [{
    "rel": "destinationIfAllowed",
    "href": "/api/customers/K0002/targets/BUSY"
  }, {
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/BUSY"
  }, {
    "rel": "inboundTrunkNumbers",
    "href": "/api/customers/K0002/targets/time-control-services/345/inbound-trunk-numbers"
  }, {
    "rel": "availableDestinations",
    "href": "/api/customers/K0002/targets/time-control-services/available-destinations"
  }, {
    "rel": "timezone",
    "href": "INHERIT"
  }],
  "data": [{
    "name": "displayName",
    "value": "time control name"
  }, {
    "name": "extensionNumber",
    "value": "576"
  }, {
    "name": "evaluationStrategy",
    "value": "AUTO"
  }, {
    "name": "fromDay",
    "value": "MONDAY"
  }, {
    "name": "fromTimeOfDay",
    "value": "02:00 PM"
  }, {
    "name": "toDay",
    "value": "FRIDAY"
  }, {
    "name": "toTimeOfDay",
    "value": "04:00 PM"
  }, {
    "name": "referralAllowed",
    "value": ["Feb 26, 2012"]
  }, {
    "name": "referralDenied",
    "value": ["Feb 27, 2012"]
  }]
}
Should not show Asterisk extension number
Given I am authenticated as customer K0002
And there is a TimeControlService
  • with name time control name
  • with service number 345
  • and asterisk extension number *77002
When I send /api/customers/K0002/targets/time-control-services/345
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/time-control-services/345",
  "data": []
}
Cannot get a missing Time Control Service
Given I am authenticated as customer K0002
and there is no Time Control Service with 404 identifier
When I send /api/customers/K0002/targets/time-control-services/404
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "title": "Time Control Service not found",
  "detail": "Time Control Service with service number 404 not found",
  "described_by": "http://api.nfon.net/probs/time-control-service-not-found"
}
Admin cannot get missing Customer's Time Control Service
Given I am authenticated as Admin
When I send /api/customers/K0404/targets/time-control-services/404
Then I should receive HTTP/1.1 404 Not Found
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"
}
Customer cannot get another Customer's Time Control Service
Given there is a Time Control Service with service number 345
and I am authenticated as Customer K0003
When I send /api/customers/K0002/targets/time-control-services/345
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 get Time Control Service of Customers, that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/time-control-services/345
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 Time Control Service of Customers, that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/time-control-services/345
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"
}