Api >

Service Portal REST API

Customer Should GET a queue service
Given I am authenticated as customer K0002
And there is a queue service
  • with name queue name
  • with service number 345
  • and extension number 576
and it has
  • periodic announcement frequency 45
  • position announcement frequency 89
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 200 OK
And Content-Type header should be application/vnd.collection.next+json
with following body:
{
  "href": "/api/customers/K0002/targets/queue-services/345",
  "links": [{
    "rel": "customer",
    "href": "/api/customers/K0002"
  }, {
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0002/targets/queue-services/345/destination-on-rejection"
  }, {
    "rel": "members",
    "href": "/api/customers/K0002/targets/queue-services/345/members"
  }, {
    "rel": "inboundTrunkNumbers",
    "href": "/api/customers/K0002/targets/queue-services/345/inbound-trunk-numbers"
  }, {
    "rel": "destinationOnTimeout",
    "href": "/api/customers/K0002/targets/queue-services/345/timeout"
  }, {
    "rel": "availableDestinationsOnRejection",
    "href": "/api/customers/K0002/targets/queue-services/available-destinations-on-rejection"
  }, {
    "rel": "availableDestinationsOnTimeout",
    "href": "/api/customers/K0002/targets/queue-services/available-destinations-on-timeout"
  }, {
    "rel": "availableGeneralAnnouncements",
    "href": "/api/customers/K0002/targets/queue-services/available-general-announcements"
  }, {
    "rel": "availableMusicOnHoldAnnouncements",
    "href": "/api/customers/K0002/targets/queue-services/available-music-on-hold-announcements"
  }],
  "data": [{
    "name": "displayName",
    "value": "queue name"
  }, {
    "name": "extensionNumber",
    "value": "576"
  }, {
    "name": "direction",
    "value": "INBOUND"
  }, {
    "name": "weight",
    "value": 0
  }, {
    "name": "ringType",
    "value": "DEFAULT"
  }, {
    "name": "selectionStrategy",
    "value": null
  }, {
    "name": "retryTimeout",
    "value": 0
  }, {
    "name": "reportHoldTime",
    "value": false
  }, {
    "name": "memberTimeout",
    "value": 0
  }, {
    "name": "memberWrapUpTime",
    "value": 0
  }, {
    "name": "periodicAnnouncementInterval",
    "value": 45
  }, {
    "name": "positionAnnouncementInterval",
    "value": 89
  }]
}
Customer Should GET a queue service's destinationOnRejection link
Given I am authenticated as customer K0002
And there is a queue service with service number 345
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 200 OK
And Content-Type header should be application/vnd.collection.next+json
with following body:
{
  "href": "/api/customers/K0002/targets/queue-services/345",
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0002/targets/queue-services/345/destination-on-rejection"
  }]
}
Should get a Queue Service with Announcements
Given I am authenticated as customer K0002
and there is a queue service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
and there is an announcement with ID 10 and it is attached as Initial Announcement, Periodic Announcement and Music On Hold Announcement
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "links": [{
    "rel": "musicOnHoldAnnouncement",
    "href": "/api/customers/K0002/announcements/10"
  }, {
    "rel": "initialAnnouncement",
    "href": "/api/customers/K0002/announcements/10"
  }, {
    "rel": "periodicAnnouncement",
    "href": "/api/customers/K0002/announcements/10"
  }]
}
GET outbound queue service ignores some properties
Given I am authenticated as customer K0002
And there is a queue service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
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": "customer",
    "href": "/api/customers/K0002"
  }, {
    "rel": "members",
    "href": "/api/customers/K0002/targets/queue-services/345/members"
  }, {
    "rel": "inboundTrunkNumbers",
    "href": "/api/customers/K0002/targets/queue-services/345/inbound-trunk-numbers"
  }, {
    "rel": "destinationOnTimeout",
    "href": "/api/customers/K0002/targets/queue-services/345/timeout"
  }, {
    "rel": "availableDestinationsOnTimeout",
    "href": "/api/customers/K0002/targets/queue-services/available-destinations-on-timeout"
  }, {
    "rel": "availableGeneralAnnouncements",
    "href": "/api/customers/K0002/targets/queue-services/available-general-announcements"
  }, {
    "rel": "availableMusicOnHoldAnnouncements",
    "href": "/api/customers/K0002/targets/queue-services/available-music-on-hold-announcements"
  }],
  "data": [{
    "name": "displayName",
    "value": "queue name"
  }, {
    "name": "extensionNumber",
    "value": "576"
  }, {
    "name": "direction",
    "value": "OUTBOUND"
  }, {
    "name": "weight",
    "value": 0
  }]
}
Should not show Asterisk extension number
Given I am authenticated as customer K0002
And there is a queue service
  • with name queue name
  • with service number 345
  • and asterisk extension number *77002
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": []
}
Missing Queue
Given I am authenticated as customer K0002
and there is no queue service with 404 identifier
When I send /api/customers/K0002/targets/queue-services/404
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
Given I am authenticated as Admin
When I send /api/customers/K404/targets/queue-services/345
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 GET another Customer's queue
Given there is a queue service
  • with name queue name
  • with service number 345
  • and asterisk extension number 456
and I am authenticated as Customer K0003
When I send /api/customers/K0002/targets/queue-services/345
Then I should receive HTTP/1.1 403 Forbidden
with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator should not be able to GET data of a Customer that he cannot manage
Given there is a queue service
  • with name queue name
  • with service number 345
  • and asterisk extension number 456
and I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/queue-services/345
Then I should receive HTTP/1.1 403 Forbidden
with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Operator should not be able to GET data of a Customer that he cannot manage
Given there is a queue service
  • with name queue name
  • with service number 345
  • and asterisk extension number 456
and I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/queue-services/345
Then I should receive HTTP/1.1 403 Forbidden
with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}