Api >

Service Portal REST API

PUT updates the Time Control Service
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Customer K0002
and the next Service Extension ID is 22
And there is a Time Control Service with service number 456
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfAllowed",
    "href": "/api/customers/K0002/targets/time-control-services/456"
  }, {
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/time-control-services/456"
  }, {
    "rel": "timezone",
    "href": "/api/time-zones/Africa.Juba"
  }],
  "data": [{
    "name": "displayName",
    "value": "differentDisplayName"
  }, {
    "name": "extensionNumber",
    "value": "999"
  }, {
    "name": "evaluationStrategy",
    "value": "ALLOW"
  }, {
    "name": "fromDay",
    "value": "TUESDAY"
  }, {
    "name": "fromTimeOfDay",
    "value": "08:32 AM"
  }, {
    "name": "toDay",
    "value": "MONDAY"
  }, {
    "name": "toTimeOfDay",
    "value": "03:09 PM"
  }, {
    "name": "referralAllowed",
    "value": []
  }, {
    "name": "referralDenied",
    "value": ["Feb 27, 2015", "Oct 27, 2015"]
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as Customer K0002
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",
  "links": [{
    "rel": "destinationIfAllowed",
    "href": "/api/customers/K0002/targets/time-control-services/456"
  }, {
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/time-control-services/456"
  }, {
    "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": "/api/time-zones/Africa.Juba"
  }],
  "data": [{
    "name": "displayName",
    "value": "differentDisplayName"
  }, {
    "name": "extensionNumber",
    "value": "999"
  }, {
    "name": "evaluationStrategy",
    "value": "ALLOW"
  }, {
    "name": "fromDay",
    "value": "TUESDAY"
  }, {
    "name": "fromTimeOfDay",
    "value": "08:32 AM"
  }, {
    "name": "toDay",
    "value": "MONDAY"
  }, {
    "name": "toTimeOfDay",
    "value": "03:09 PM"
  }, {
    "name": "referralAllowed",
    "value": []
  }, {
    "name": "referralDenied",
    "value": ["Feb 27, 2015", "Oct 27, 2015"]
  }]
}
PUT updates the Time Control Service (using target href)
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Customer K0002
and the next Service Extension ID is 22
And there is a Time Control Service with service number 456
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfAllowed",
    "href": "/api/customers/K0002/targets/time-control-services/456"
  }, {
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/time-control-services/456"
  }, {
    "rel": "timezone",
    "href": "/api/time-zones/Africa.Juba"
  }],
  "data": [{
    "name": "displayName",
    "value": "differentDisplayName"
  }, {
    "name": "extensionNumber",
    "value": "999"
  }, {
    "name": "evaluationStrategy",
    "value": "ALLOW"
  }, {
    "name": "fromDay",
    "value": "TUESDAY"
  }, {
    "name": "fromTimeOfDay",
    "value": "08:32 AM"
  }, {
    "name": "toDay",
    "value": "MONDAY"
  }, {
    "name": "toTimeOfDay",
    "value": "03:09 PM"
  }, {
    "name": "referralAllowed",
    "value": []
  }, {
    "name": "referralDenied",
    "value": ["Feb 27, 2015", "Oct 27, 2015"]
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as Customer K0002
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",
  "links": [{
    "rel": "destinationIfAllowed",
    "href": "/api/customers/K0002/targets/time-control-services/456"
  }, {
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/time-control-services/456"
  }, {
    "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": "/api/time-zones/Africa.Juba"
  }],
  "data": [{
    "name": "displayName",
    "value": "differentDisplayName"
  }, {
    "name": "extensionNumber",
    "value": "999"
  }, {
    "name": "evaluationStrategy",
    "value": "ALLOW"
  }, {
    "name": "fromDay",
    "value": "TUESDAY"
  }, {
    "name": "fromTimeOfDay",
    "value": "08:32 AM"
  }, {
    "name": "toDay",
    "value": "MONDAY"
  }, {
    "name": "toTimeOfDay",
    "value": "03:09 PM"
  }, {
    "name": "referralAllowed",
    "value": []
  }, {
    "name": "referralDenied",
    "value": ["Feb 27, 2015", "Oct 27, 2015"]
  }]
}
PUT updates the Time Control Service with timezone with '.' separator
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Customer K0002
and the next Service Extension ID is 22
And there is a Time Control Service with service number 456
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "timezone",
    "href": "/api/time-zones/America.North_Dakota.Center"
  }],
  "data": []
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as Customer K0002
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",
  "links": [{
    "rel": "timezone",
    "href": "/api/time-zones/America.North_Dakota.Center"
  }],
  "data": []
}
PUT updates the Time Control Service with timezone with '/' separator
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Customer K0002
and the next Service Extension ID is 22
And there is a Time Control Service with service number 456
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "timezone",
    "href": "/api/time-zones/America/North_Dakota/Center"
  }],
  "data": []
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as Customer K0002
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",
  "links": [{
    "rel": "timezone",
    "href": "/api/time-zones/America.North_Dakota.Center"
  }],
  "data": []
}
Should not update the Time Control Service with invalid displayName
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "new name?"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Display name should not contain these characters: & $ ! ? = | \" { }",
    "path": "displayName",
    "value": "new name?"
  }]
}
Should not update the Time Control Service using a displayName with invalid length
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "this is a way, way, way, way, way, way, way, way, way to long displayName"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Display name should have a length between 1 and 50 characters",
    "path": "displayName",
    "value": "this is a way, way, way, way, way, way, way, way, way to long displayName"
  }]
}
Should not update the Time Control Service with empty displayName
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": ""
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Display name is missing",
    "path": "displayName",
    "value": ""
  }]
}
Cannot update the Time Control Service using an extension number with invalid format
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "extensionNumber",
    "value": "0123"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Invalid extension number format. Must not start with the dial-out-prefix (default 0)",
    "path": "extensionNumber",
    "value": "0123"
  }]
}
Should not update the Time Control Service using too long extension number
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "extensionNumber",
    "value": "12345678901234567890123456789"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Extension number length should not exceed 20 characters",
    "path": "extensionNumber",
    "value": "12345678901234567890123456789"
  }]
}
Should not update the Time Control Service using duplicate extension number
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and there is already an extension with extension number 12345 When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "extensionNumber",
    "value": "12345"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Extension number is not unique.",
    "path": "extensionNumber",
    "value": "12345"
  }]
}
Should not update the Time Control Service with invalid Evaluation Strategy
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "evaluationStrategy",
    "value": "INVALID"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Unknown enum value. Allowed values: [AUTO, ALLOW, DENY]",
    "path": "evaluationStrategy",
    "value": "INVALID"
  }]
}
Should not update the Time Control Service with invalid Timezone
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "timezone",
    "href": "/api/time-zones/invalid"
  }],
  "data": []
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "timezone must be given in an 'area/location' format",
    "path": "timezone",
    "value": "invalid"
  }]
}
Should not update the Time Control Service with valid but not existing Timezone
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "timezone",
    "href": "/api/time-zones/abc.def"
  }],
  "data": []
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "detail": "Could not create or update resource due to constraint violations",
  "title": "Validation error",
  "errors": [{
    "message": "timezone '/api/time-zones/abc.def' not found",
    "path": "timezone",
    "value": "abc.def"
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Should not update the Time Control Service with invalid From Day
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "fromDay",
    "value": "invalid"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Unknown enum value. Allowed values: [MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY]",
    "path": "fromDay",
    "value": "invalid"
  }]
}
Should not update the Time Control Service with invalid From Time Of Day
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "fromTimeOfDay",
    "value": "11:35 AMxyz"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "fromTimeOfDay must be in the format 'hh:mm AM/PM'",
    "path": "fromTimeOfDay",
    "value": "11:35 AMxyz"
  }]
}
Should not update the Time Control Service with incorrect referral date
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "referralAllowed",
    "value": ["not a date"]
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "referral date must be in the format 'MMM dd, yyyy'",
    "path": "referralAllowed",
    "value": "not a date"
  }]
}
Should not update the Time Control Service with duplicated referral date
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "referralDenied",
    "value": ["Oct 21, 2015", "Oct 21, 2015"]
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "duplicate referral date",
    "path": "referralDenied",
    "value": "Oct 21, 2015"
  }]
}
Should not update the Time Control Service with same date in allowed and denied referrals
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "referralAllowed",
    "value": ["Feb 27, 2012"]
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Cannot specify the same date for allowed and denied referral at the same time",
    "path": "referralAllowed",
    "value": "Feb 27, 2012"
  }]
}
Should not update the Time Control Service with link to current Time Control Service as a destinationIfDenied
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/time-control-services/345"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "destinationIfDenied cannot point to source and should be one of: [BUSY, CONFERENCE, EFAX, FRONTDESK, GROUP, HANG_UP, IVR, PHONEEXTENSION, QUEUE, ROUTINGPREFIX, SKILL, TIMECONTROL, VOICEMAIL]",
    "path": "destinationIfDenied",
    "value": "TIMECONTROL"
  }]
}
Should not update the Time Control Service with destinationIfDenied link of type NO_ACTION
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/NO_ACTION"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "destinationIfDenied cannot point to source and should be one of: [BUSY, CONFERENCE, EFAX, FRONTDESK, GROUP, HANG_UP, IVR, PHONEEXTENSION, QUEUE, ROUTINGPREFIX, SKILL, TIMECONTROL, VOICEMAIL]",
    "path": "destinationIfDenied",
    "value": "NOOP"
  }]
}
Should not update the Time Control Service with destinationIfDenied link of type REPEAT
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/REPEAT"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "destinationIfDenied cannot point to source and should be one of: [BUSY, CONFERENCE, EFAX, FRONTDESK, GROUP, HANG_UP, IVR, PHONEEXTENSION, QUEUE, ROUTINGPREFIX, SKILL, TIMECONTROL, VOICEMAIL]",
    "path": "destinationIfDenied",
    "value": "REPEAT"
  }]
}
Should not update the Time Control Service with destinationIfDenied link of type PHONEBOOK
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and the next Phone Extension ID is 1000
and there is a Phone Book with number +48 (123) 123123 name phone book
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/phone-books/1000"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "destinationIfDenied cannot point to source and should be one of: [BUSY, CONFERENCE, EFAX, FRONTDESK, GROUP, HANG_UP, IVR, PHONEEXTENSION, QUEUE, ROUTINGPREFIX, SKILL, TIMECONTROL, VOICEMAIL]",
    "path": "destinationIfDenied",
    "value": "PHONEBOOK"
  }]
}
Should not update the Time Control Service with destinationIfDenied link of type DIRECTDIAL
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and the next Direct Dial ID is 2000
and there is a Direct Dial with number +48 (10) 1234 and extension 777
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/direct-dial/00491012234"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "destinationIfDenied cannot point to source and should be one of: [BUSY, CONFERENCE, EFAX, FRONTDESK, GROUP, HANG_UP, IVR, PHONEEXTENSION, QUEUE, ROUTINGPREFIX, SKILL, TIMECONTROL, VOICEMAIL]",
    "path": "destinationIfDenied",
    "value": "DIRECTDIAL"
  }]
}
Should update the Time Control Service with destinationIfDenied link of type BUSY
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/BUSY"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Should update the Time Control Service with destinationIfDenied link of type HANGUP
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/HANGUP"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Should update the Time Control Service with destinationIfDenied link of type EFAX
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and the next Virtual Fax Extension ID is 2000
and there is an Virtual Fax with extension 123
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/virtual-fax-extensions/123"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Should update the Time Control Service with destinationIfDenied link of type VOICEMAIL
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and there is a Voice Mail for Phone Extension with ID 2000
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/phone-extensions/777"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Should update the Time Control Service with destinationIfDenied link of type IVR
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and the next IVR Service ID is 2000
and there is a IVR Service with service number 555
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/ivr-services/555"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Should update the Time Control Service with destinationIfDenied link of type GROUP
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and the next Group Service ID is 2000
and there is a Group Service with service number 555
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/group-services/555"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Should update the Time Control Service with destinationIfDenied link of type QUEUE
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and the next Queue Service ID is 2000
and there is a Queue Service with service number 555
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/queue-services/555"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Should update the Time Control Service with destinationIfDenied link of type SKILL
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and the next Conference Service ID is 2000
and there is a Conference Service with service number 555
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/conference-services/555"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Should update the Time Control Service with destinationIfDenied link of type CONFERENCE
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and the next Skill Service ID is 2000
and there is a Skill Service with service number 555
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/skill-services/555"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Should not update the Time Control Service with null destinationIfAllowed
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfAllowed",
    "href": null
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "destinationIfAllowed cannot be null",
    "path": "destinationIfAllowed",
    "value": null
  }]
}
Cannot update the Time Control Service with not existing destinationIfAllowed
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfAllowed",
    "href": "/api/customers/K0002/targets/phone-extensions/404"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "detail": "Extension with extension number 404 has not been found",
  "title": "Extension not found",
  "described_by": "http://api.nfon.net/probs/extension-not-found"
}
Customer cannot update the Time Control Service's destinationIfAllowed with another Customer's destination
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Customer K0002
and there is another Customer K0003
When I send /api/customers/K0002/targets/time-control-services/345 as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfAllowed",
    "href": "/api/customers/K0003/targets/BUSY"
  }]
}
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"
}
Admin cannot update the Time Control Service's destinationIfAllowed with another Customer's destination
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Admin
and there is another Customer K0003
When I send /api/customers/K0002/targets/time-control-services/345 as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfAllowed",
    "href": "/api/customers/K0003/targets/BUSY"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Destination must belong to the owner of Time Control Service",
    "path": "destinationIfAllowed"
  }]
}
Cannot update the Time Control Service with not existing destinationIfDenied
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0002/targets/phone-extensions/404"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "detail": "Extension with extension number 404 has not been found",
  "title": "Extension not found",
  "described_by": "http://api.nfon.net/probs/extension-not-found"
}
Customer cannot update the Time Control Service's destinationIfDenied with another Customer's destination
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Customer K0002
and there is another Customer K0003
When I send /api/customers/K0002/targets/time-control-services/345 as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0003/targets/BUSY"
  }]
}
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"
}
Admin cannot update the Time Control Service's destinationIfDenied with another Customer's destination
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Admin
and there is another Customer K0003
When I send /api/customers/K0002/targets/time-control-services/345 as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "destinationIfDenied",
    "href": "/api/customers/K0003/targets/BUSY"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Destination must belong to the owner of Time Control Service",
    "path": "destinationIfDenied"
  }]
}
Cannot update a missing Time Control Service
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
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 as application/json; charset=UTF-8
with following body:
{
  "data": []
}
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 update a missing Customer's Time Control Service
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Admin
When I send /api/customers/K0404/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": []
}
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"
}
Customer cannot update another Customer's Time Control Service
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Customer K0003
When I /api/customers/K0002/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": []
}
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 update another Time Control Service for Customer, that does not belong to him
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as System Integrator S0002
When I /api/customers/K0003/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": []
}
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"
}
Operator cannot update another Time Control Service for Customer, that does not belong to him
Test setup
Given the next Service Extension ID is 13
and there is a Time Control Service
  • with name time control name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Operator C0002
When I /api/customers/K0003/targets/time-control-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": []
}
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"
}