Api >

Service Portal REST API

POST creates a IVR Service Key Assignment
Given I am authenticated as K0002
and there is a IVR Service 17
and there is a Phone Extension with id 31 and extension 43
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
Then I should receive HTTP/1.1 201 Created with http://localhost:9998/api/customers/K0002/targets/ivr-services/17/key-assignments/7
with following body:
{
  "href": "/api/customers/K0002/targets/ivr-services/17/key-assignments/7"
}
and given I am authenticated as K0002
when I send /api/customers/K0002/targets/ivr-services/17/key-assignments/7
then I should receive HTTP/1.1 200 OK
with following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
POST creates a multi digit IVR Service Key Assignment
Given I am authenticated as K0002
and there is a IVR Service 17 with maximum allowed number of digits set to 3
and there is a Phone Extension with id 31 and extension 43
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "117"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
Then I should receive HTTP/1.1 201 Created
with following body:
{
  "href": "/api/customers/K0002/targets/ivr-services/17/key-assignments/117"
}
and given I am authenticated as K0002
when I send /api/customers/K0002/targets/ivr-services/17/key-assignments/117
then I should receive HTTP/1.1 200 OK
with following body
{
  "data": [{
    "name": "number",
    "value": "117"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
POST returns 400 if there is no number provided
Given I am authenticated as K0002
and there is a IVR Service 17
and there is a Phone Extension with id 31 and extension 43
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Key Assignment number is required",
    "path": "number"
  }]
}
POST returns 400 if there is no target provided
Given I am authenticated as K0002
and there is a IVR Service 17
and there is a Phone Extension with id 31 and extension 43
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "7"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Key Assignment target is required",
    "path": "target"
  }]
}
POST returns 400 if provided number is already taken
Given I am authenticated as K0002
and there is a IVR Service 17
and there is a Phone Extension with id 31 and extension 43
which is assigned to IVR Service number 7 When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Key Assignment with number 7 already exists",
    "path": "number",
    "value": "7"
  }]
}
POST returns 400 if provided multi digit number is already taken
Given I am authenticated as K0002
and there is a IVR Service 17 with maximum allowed number of digits set to 3
and there is a Phone Extension with id 31 and extension 43
which is assigned to IVR Service number 117 When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "117"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Key Assignment with number 117 already exists",
    "path": "number",
    "value": "117"
  }]
}
POST returns 400 if provided number has invalid format
Given I am authenticated as K0002
and there is a IVR Service 17
and there is a Phone Extension with id 31 and extension 43
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "y"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Provided number should consist of digits only or be equal * or #",
    "path": "number",
    "value": "y"
  }]
}
POST returns 400 if provided number is too long
Given I am authenticated as K0002
and there is a IVR Service 17 with maximum allowed number of digits set to 3
and there is a Phone Extension with id 31 and extension 43
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "12345"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Provided number 12345 is longer than allowed maxNumberOfDigits 3",
    "path": "number",
    "value": "12345"
  }]
}
POST does not create a IVR Service Key Assignment with enclosing IVR Service target
Given I am authenticated as Customer K0002
and there is a IVR Service with Id 143 and service number 17
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/ivr-services/17"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "target cannot point to source and should be one of: [CONFERENCE, FRONTDESK, GROUP, HANG_UP, IVR, NOOP, PHONEEXTENSION, QUEUE, REPEAT, ROUTINGPREFIX, SKILL, TIMECONTROL, VOICEMAIL, VOICEMAIL_SERVICE]",
    "path": "target",
    "value": "IVR"
  }]
}
POST does not create an IVR Service Key Assignment with not existing target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/ivr-services/404"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
with following body
{
  "detail": "IVR Service with service number 404 not found",
  "title": "IVR Service not found",
  "described_by": "http://api.nfon.net/probs/ivr-service-not-found"
}
POST does not create a IVR Service Key Assignment with BUSY target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/BUSY"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "target cannot point to source and should be one of: [CONFERENCE, FRONTDESK, GROUP, HANG_UP, IVR, NOOP, PHONEEXTENSION, QUEUE, REPEAT, ROUTINGPREFIX, SKILL, TIMECONTROL, VOICEMAIL, VOICEMAIL_SERVICE]",
    "path": "target",
    "value": "BUSY"
  }]
}
POST tries creates a IVR Service Key Assignment with OWN_VOICEMAIL target but must fail
Given I am authenticated as Customer K0002
and there is a IVR Service 17
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/OWN_VOICEMAIL"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
POST does not create a IVR Service Key Assignment with EFAX target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
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/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/virtual-fax-extensions/123"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
POST does not create a IVR Service Key Assignment with PHONEBOOK target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
and the next Phonebook ID is 2000
and there is a Phone Book with number +48 (10) 1234
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/phone-books/2000"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
POST does not create a IVR Service Key Assignment with DIRECTDIAL target (new direct dial endpoint)
Given I am authenticated as Customer K0002
and there is a IVR Service 17
and extension 777
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/direct-dial/+48(10)1234"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
POST creates an IVR Service Key Assignment with null target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": null
  }]
}
Then I should receive HTTP/1.1 201 Created
POST creates an IVR Service Key Assignment with NO_ACTION target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/NO_ACTION"
  }]
}
Then I should receive HTTP/1.1 201 Created
POST creates a IVR Service Key Assignment with HANGUP target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/HANGUP"
  }]
}
Then I should receive HTTP/1.1 201 Created
POST creates a IVR Service Key Assignment with REPEAT target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/REPEAT"
  }]
}
Then I should receive HTTP/1.1 201 Created
POST creates a IVR Service Key Assignment with VOICEMAIL target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
and there is a Voice Mail for Phone Extension with ID 2000
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/777/voice-mail"
  }]
}
Then I should receive HTTP/1.1 201 Created
POST creates a IVR Service Key Assignment with IVR target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
and the next IVR Service ID is 2000
and there is a IVR Service with service number 345
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/ivr-services/345"
  }]
}
Then I should receive HTTP/1.1 201 Created
POST creates a IVR Service Key Assignment with GROUP target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
and the next Group Service ID is 2000
and there is a Group Service with service number 345
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/group-services/345"
  }]
}
Then I should receive HTTP/1.1 201 Created
POST creates a IVR Service Key Assignment with QUEUE target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
and the next Queue Service ID is 2000
and there is a Queue Service with service number 345
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/queue-services/345"
  }]
}
Then I should receive HTTP/1.1 201 Created
POST creates a IVR Service Key Assignment with SKILL target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
and the next Skill Service ID is 2000
and there is a Skill Service with service number 345
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/skill-services/345"
  }]
}
Then I should receive HTTP/1.1 201 Created
POST creates a IVR Service Key Assignment with TIMECONTROL target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
and the next Time Control Service ID is 2000
and there is a Time Control Service with service number 345
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/time-control-services/345"
  }]
}
Then I should receive HTTP/1.1 201 Created
POST creates a IVR Service Key Assignment with CONFERENCE target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
and the next Conference Service ID is 2000
and there is a Conference Service with service number 345
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/conference-services/345"
  }]
}
Then I should receive HTTP/1.1 201 Created
POST creates a IVR Service Key Assignment with VOICEMAIL_SERVICE target
Given I am authenticated as Customer K0002
and there is a IVR Service 17
and the next Voice Mail Service ID is 2000
and there is a Voice Mail Service
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/VOICEMAILSERVICE"
  }]
}
Then I should receive HTTP/1.1 201 Created
POST returns 404 if requested IVR Service does not exist
Given I am authenticated as K0002
and there is a Phone Extension with id 31 and extension 43
but there is no IVR Service 404
When I send /api/customers/K0002/targets/ivr-services/404/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "title": "IVR Service not found",
  "detail": "IVR Service with service number 404 not found",
  "described_by": "http://api.nfon.net/probs/ivr-service-not-found"
}
POST returns 404 if requested Customer doesn't exist
Given I am authenticated as Admin
When I send /api/customers/K404/targets/ivr-services/123/key-assignments as application/json; charset=UTF-8 with following body:
{}
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "title": "Customer not found",
  "detail": "Customer with identifier K404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
POST returns 403 if Customer tries to add a Key Assignment to another Customer's IVR Service
Given I am authenticated as K0003
and there is a IVR Service 17 that belongs to Customer K0002
and there is a Phone Extension with id 31 and extension 43 that belongs to Customer K0003
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
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"
}
POST returns 403 if tries to add a Key Assignment to it's own IVR Service using another Customer's target
Given I am authenticated as K0002
and there is a IVR Service 17 that belongs to Customer K0002
and there is a Phone Extension with id 31 and extension 43 that belongs to Customer K0003
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0003/targets/phone-extensions/43"
  }]
}
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"
}
POST returns 400 if Admin tries to add a Key Assignment to IVR Service using another Customer's target
Given I am authenticated as admin
and there is a IVR Service 17 that belongs to Customer K0002
and there is a Phone Extension with id 31 and extension 43 that belongs to Customer K0003
When I send /api/customers/K0002/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0003/targets/phone-extensions/43"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Target must belong to the owner of IVR Service",
    "path": "target"
  }]
}
System Integrator should not be able to create Key Assignments for Customer, that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Operator should not be able to create Key Assignments for Customer, that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/ivr-services/17/key-assignments as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "number",
    "value": "7"
  }],
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/43"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}