Api >

Service Portal REST API

Customer should be able to update the Queue Service
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "memberAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }],
  "data": [{
    "name": "displayName",
    "value": "new display name"
  }, {
    "name": "extensionNumber",
    "value": "12345"
  }, {
    "name": "weight",
    "value": 3
  }, {
    "name": "direction",
    "value": "INBOUND"
  }, {
    "name": "ringType",
    "value": "RING"
  }, {
    "name": "selectionStrategy",
    "value": "ROUND_ROBIN"
  }, {
    "name": "retryTimeout",
    "value": 11
  }, {
    "name": "memberTimeout",
    "value": 22
  }, {
    "name": "memberWrapUpTime",
    "value": 33
  }, {
    "name": "reportHoldTime",
    "value": true
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "links": [{
    "rel": "memberAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }],
  "data": [{
    "name": "displayName",
    "value": "new display name"
  }, {
    "name": "extensionNumber",
    "value": "12345"
  }, {
    "name": "weight",
    "value": 3
  }, {
    "name": "direction",
    "value": "INBOUND"
  }, {
    "name": "ringType",
    "value": "RING"
  }, {
    "name": "selectionStrategy",
    "value": "ROUND_ROBIN"
  }, {
    "name": "retryTimeout",
    "value": 11
  }, {
    "name": "memberTimeout",
    "value": 22
  }, {
    "name": "memberWrapUpTime",
    "value": 33
  }, {
    "name": "reportHoldTime",
    "value": true
  }]
}
Customer should be able to set Ring Type to CUSTOM
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and Queue Service ring type is type of DEFAULT
and there is an MUSIC_ON_HOLD_QUEUE announcement with ID 1010
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "ringType",
    "value": "CUSTOM"
  }],
  "links": [{
    "rel": "musicOnHoldAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/queue-services/345",
  "data": [{
    "name": "ringType",
    "value": "CUSTOM"
  }],
  "links": [{
    "rel": "musicOnHoldAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Customer should be able to update music on hold announcement for Queue Service with ring type CUSTOM
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and Queue Service ring type is type of CUSTOM
and there is an MUSIC_ON_HOLD_QUEUE announcement with ID 1010
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "musicOnHoldAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/queue-services/345",
  "links": [{
    "rel": "musicOnHoldAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Customer should be able to un assign musicOnHoldAnnouncement when Queue Service's Ring Type is CUSTOM
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and Queue Service ring type is type of CUSTOM
and there is an MUSIC_ON_HOLD_QUEUE announcement with ID 1010
that is set as Queue's Music On Hold Announcement
When I send /api/customers/K0002/targets/queue-services/345 as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "musicOnHoldAnnouncement",
    "href": null
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 200 OK
and the body should not contain musicOnHoldAnnouncement link
Customer should set ring type
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and Queue Service ring type is type of DEFAULT
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "ringType",
    "value": "RING"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/queue-services/345",
  "data": [{
    "name": "ringType",
    "value": "RING"
  }]
}
PUT should not allow to set Ring Type to null
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and Queue Service ring type is type of CUSTOM
When I send /api/customers/K0002/targets/queue-services/345 as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "ringType",
    "value": null
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "ringType cannot be null",
    "path": "ringType",
    "value": null
  }]
}
Should not allow to set MusicOnHold with type different than MUSIC_ON_HOLD_QUEUE
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and Queue Service ring type is type of CUSTOM
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "musicOnHoldAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Expected musicOnHoldAnnouncement to be type of [MUSIC_ON_HOLD_QUEUE] but was [GENERAL_ANNOUNCEMENT]",
    "path": "musicOnHoldAnnouncement",
    "value": "/api/customers/K0002/announcements/1010"
  }]
}
Should not update ring type for Outbound Queue Service
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and there is a Queue Service
  • with name outbound queue name
  • with service number 876
  • and asterisk extension number 234
When I send /api/customers/K0002/targets/queue-services/876
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "ringType",
    "value": "RING"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Option cannot be set for Outbound QueueService",
    "path": "ringType",
    "value": "RING"
  }]
}
Should not update the Queue Service with invalid displayName
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-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?"
  }]
}
Missing member announcement
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "memberAnnouncement",
    "href": "/api/customers/K0002/announcements/1"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "title": "Announcement not found",
  "detail": "Announcement with id 1 has not been found",
  "described_by": "http://api.nfon.net/probs/announcement-not-found"
}
Customer should be able to update intervals in Customer Options
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "positionAnnouncementInterval",
    "value": 11
  }, {
    "name": "periodicAnnouncementInterval",
    "value": 44
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/queue-services/345",
  "data": [{
    "name": "positionAnnouncementInterval",
    "value": 11
  }, {
    "name": "periodicAnnouncementInterval",
    "value": 44
  }]
}
Should set periodic announcement with proper type (GENERAL_ANNOUNCEMENT)
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "periodicAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/queue-services/345",
  "links": [{
    "rel": "periodicAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Should NOT set periodic announcement with NOT proper type (MUSIC_ON_HOLD)
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and there is an MUSIC_ON_HOLD announcement with ID 1010
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "periodicAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Expected periodicAnnouncement to be type of [GENERAL_ANNOUNCEMENT] but was [MUSIC_ON_HOLD]",
    "path": "periodicAnnouncement"
  }]
}
Should set initial announcement with proper type (GENERAL_ANNOUNCEMENT)
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "initialAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/queue-services/345",
  "links": [{
    "rel": "initialAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Should NOT set initial announcement with NOT proper type (MUSIC_ON_HOLD)
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and there is an MUSIC_ON_HOLD announcement with ID 1010
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "initialAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Expected initialAnnouncement to be type of [GENERAL_ANNOUNCEMENT] but was [MUSIC_ON_HOLD]",
    "path": "initialAnnouncement"
  }]
}
Should not update a Queue Service with duplicated displayName
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
And there is a queue service
  • with name aDisplayName
  • with service number 888
  • and extension number 999
When I send /api/customers/K0002/targets/queue-services/888
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "queue name"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Display name must be unique",
    "path": "displayName",
    "value": "queue name"
  }]
}
Customer should not be able to update Position Announcement Interval in Customer Options when value is too low
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "positionAnnouncementInterval",
    "value": -1
  }]
}
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": "must be non-negative",
    "path": "positionAnnouncementInterval",
    "value": -1
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Customer should not be able to update Position Announcement Interval in Customer Options when value is too high
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "positionAnnouncementInterval",
    "value": 1000
  }]
}
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": "must be smaller than 1000",
    "path": "positionAnnouncementInterval",
    "value": 1000
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Customer should not be able to update Periodic Announcement Interval in Customer Options when value is too low
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "periodicAnnouncementInterval",
    "value": -1
  }]
}
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": "must be non-negative",
    "path": "periodicAnnouncementInterval",
    "value": -1
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Customer should not be able to update Periodic Announcement Interval in Customer Options when value is too high
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "periodicAnnouncementInterval",
    "value": 1000
  }]
}
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": "must be smaller than 1000",
    "path": "periodicAnnouncementInterval",
    "value": 1000
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Missing Queue
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given there is no Queue Service with 404 identifier
and I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-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": "Queue not found",
  "detail": "Queue with serviceNumber 404 not found",
  "described_by": "http://api.nfon.net/probs/queue-not-found"
}
Missing Customer
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Admin
When I send /api/customers/K404/targets/queue-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 K404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Customer should not be able to change another Customer's queue
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Customer K0003
When I /api/customers/K0002/targets/queue-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 should not be able to change data of a Customer that he cannot manage
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as System Integrator S0002
When I /api/customers/K0003/targets/queue-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 should not be able to GET data of a Customer that he cannot manage
Test setup
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Operator C0002
When I /api/customers/K0003/targets/queue-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"
}