Api >

Service Portal REST API

Can update an IVR Service Key Assignment
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
and there is a Phone Extension with ID 1555
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/777"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Then given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4
Then I should receive HTTP/1.1 200 OK
with following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/777"
  }]
}
Can update a multidigit IVR Service Key Assignment
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
and max number of digits for IVR Service is set to 3
and there is another Phone Extension with ID 1555
and there is Key Assignment which assigns 103 to this Phone Extension
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/103 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/777"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Then given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/103
Then I should receive HTTP/1.1 200 OK
with following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/777"
  }]
}
Cannot update an IVR Service Key Assignment's number
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "data": [{
    "name": "number",
    "value": "8"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Cannot update the number of Key Assignment - number is read only value",
    "path": "number"
  }]
}
Then given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4
Then I should receive HTTP/1.1 200 OK
with following body
{
  "data": [{
    "name": "number",
    "value": "4"
  }]
}
Cannot update an IVR Service Key Assignment with enclosing IVR Service
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/ivr-services/123"
  }]
}
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"
  }]
}
Cannot update an IVR Service Key Assignment with not existing target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "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"
}
Cannot update a IVR Service Key Assignment with BUSY target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "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"
  }]
}
Cannot update a IVR Service Key Assignment with EFAX target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
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/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/virtual-fax-extensions/123"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
Cannot update a IVR Service Key Assignment with PHONEBOOK target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
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/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/phone-books/2000"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
Cannot update a IVR Service Key Assignment with DIRECTDIAL target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
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/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/direct-dial/0048101234"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
Cannot update a IVR Service Key Assignment with DIRECTDIAL target (new direct dial endpoint)
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
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/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/direct-dial/+48(10)1234"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
Cannot update an IVR Service Key Assignment with null target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
and there is a IVR Service 17
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": null
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
{}
Cannot update an IVR Service Key Assignment with NO_ACTION target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/NO_ACTION"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
{}
Can update a IVR Service Key Assignment with HANGUP target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/HANGUP"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Can update a IVR Service Key Assignment with REPEAT target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/REPEAT"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Can update a IVR Service Key Assignment with VOICEMAIL target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
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/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/phone-extensions/777/voice-mail"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Can update a IVR Service Key Assignment with IVR target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
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/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/ivr-services/345"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Can update a IVR Service Key Assignment with GROUP target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
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/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/group-services/345"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Can update a IVR Service Key Assignment with QUEUE target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
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/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/queue-services/345"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Can update a IVR Service Key Assignment with SKILL target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
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/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/skill-services/345"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Can update a IVR Service Key Assignment with TIMECONTROL target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
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/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/time-control-services/345"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Can update a IVR Service Key Assignment with CONFERENCE target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
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/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/conference-services/345"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Can update a IVR Service Key Assignment with VOICEMAIL_SERVICE target
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
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/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/VOICEMAILSERVICE"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Update of IVR Service Key Assignment with NO_ACTION target should remove this assignment
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0002/targets/NO_ACTION"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
{}
Then given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4
Then I should receive HTTP/1.1 200 OK
Customer cannot update a IVR Service Key Assignment with target of another Customer
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given there is a Phone Extension with ID 2000 assigned to Customer K0003
and I am authenticated as customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0003/targets/phone-extensions/888"
  }]
}
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 a IVR Service Key Assignment with target of another Customer
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given there is a Phone Extension with ID 2000 assigned to Customer K0003
and I am authenticated as admin
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{
  "links": [{
    "rel": "target",
    "href": "/api/customers/K0003/targets/phone-extensions/888"
  }]
}
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"
  }]
}
Missing Key Assignment
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/404 as application/json; charset=utf-8
and following body
{}
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "title": "IVR Service Key Assignment not found",
  "detail": "IVR Service Key Assignment with id 404 has not been found",
  "described_by": "http://api.nfon.net/probs/ivr-service-key-assignment-not-found"
}
Missing Customer
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Admin
When I send /api/customers/K404/targets/ivr-services/123/key-assignments/1 as application/json; charset=utf-8
and 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"
}
Customer should not be able to update another Customer's Key Assignment
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Customer K0003
When I send /api/customers/K0002/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{}
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 should not be able to update Key Assignment of Customer, that does not belong to him
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{}
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 update Key Assignment of Customer, that does not belong to him
Test setup
Given the next IVR Service ID is 500
and there is an IVR Service with service number 123
and there is a Phone Extension with ID 1000
and the Key Assignment which assigns 4 to this Phone Extension
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/ivr-services/123/key-assignments/4 as application/json; charset=utf-8
and following body
{}
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"
}