Api >

Service Portal REST API

Customer should be able to update the skill service
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given there is no skill service with 404 identifier
and I am authenticated as customer K0002
When I try to change a skill /api/customers/K0002/targets/skill-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "new display name"
  }, {
    "name": "extensionNumber",
    "value": "3737"
  }, {
    "name": "weight",
    "value": 7
  }, {
    "name": "selectionStrategy",
    "value": "ROUND_ROBIN"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as customer K0002
When I ask for a skill /api/customers/K0002/targets/skill-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/skill-services/345",
  "data": [{
    "name": "displayName",
    "value": "new display name"
  }, {
    "name": "extensionNumber",
    "value": "3737"
  }, {
    "name": "weight",
    "value": 7
  }, {
    "name": "selectionStrategy",
    "value": "ROUND_ROBIN"
  }]
}
Customer should be able to set Ring Type to CUSTOM
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and skill service ring type is type of DEFAULT
and there is an MUSIC_ON_HOLD_SKILL announcement with ID 1010
When I try to change a skill /api/customers/K0002/targets/skill-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 ask for a skill /api/customers/K0002/targets/skill-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/skill-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 Skill Service with ring type CUSTOM
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and skill service ring type is type of CUSTOM
and there is an MUSIC_ON_HOLD_SKILL announcement with ID 1010
When I try to change a skill /api/customers/K0002/targets/skill-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 ask for a skill /api/customers/K0002/targets/skill-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/skill-services/345",
  "links": [{
    "rel": "musicOnHoldAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }]
}
Customer should not be able to un assign musicOnHoldAnnouncement when Skill Service's Ring Type is CUSTOM
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and Skill Service ring type is type of CUSTOM
and there is an MUSIC_ON_HOLD_SKILL announcement with ID 1010
that is set as Skill's Music On Hold Announcement
When I send /api/customers/K0002/targets/skill-services/345 as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "musicOnHoldAnnouncement",
    "href": null
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
Customer should set ring type
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and skill service ring type is type of DEFAULT
When I try to change a skill /api/customers/K0002/targets/skill-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 ask for a skill /api/customers/K0002/targets/skill-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/skill-services/345",
  "data": [{
    "name": "ringType",
    "value": "RING"
  }]
}
PUT should not allow to set Ring Type to null
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and Skill Service ring type is type of CUSTOM
When I send /api/customers/K0002/targets/skill-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_SKILL
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
and skill service ring type is type of CUSTOM
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I try to change a skill /api/customers/K0002/targets/skill-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
And Content-Type header should be application/api-problem+json
with following body:
{
  "errors": [{
    "message": "Expected musicOnHoldAnnouncement to be type of [MUSIC_ON_HOLD_SKILL] but was [GENERAL_ANNOUNCEMENT]",
    "path": "musicOnHoldAnnouncement",
    "value": "/api/customers/K0002/announcements/1010"
  }]
}
Should not update ring type for Outbound Skill service
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given there is a skill service
  • with name outbound skill name
  • with service number 876
  • and asterisk extension number 234
and I am authenticated as customer K0002
When I try to change a skill /api/customers/K0002/targets/skill-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
And Content-Type header should be application/api-problem+json
with following body:
{
  "errors": [{
    "message": "Option cannot be set for Outbound SkillService",
    "path": "ringType",
    "value": "RING"
  }]
}
Should not update the skill service with invalid displayName
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I try to change a skill /api/customers/K0002/targets/skill-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
And Content-Type header should be application/api-problem+json
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 skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I try to change a skill /api/customers/K0002/targets/skill-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
And Content-Type header should be application/api-problem+json
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 skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I try to change a skill /api/customers/K0002/targets/skill-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 ask for a skill /api/customers/K0002/targets/skill-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/skill-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 skill service
  • with name skill 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 try to change a skill /api/customers/K0002/targets/skill-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 ask for a skill /api/customers/K0002/targets/skill-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/skill-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 skill service
  • with name skill 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 try to change a skill /api/customers/K0002/targets/skill-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
And Content-Type header should be application/api-problem+json
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 skill service
  • with name skill 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 try to change a skill /api/customers/K0002/targets/skill-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 ask for a skill /api/customers/K0002/targets/skill-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/skill-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 skill service
  • with name skill 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 try to change a skill /api/customers/K0002/targets/skill-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
And Content-Type header should be application/api-problem+json
with following body:
{
  "errors": [{
    "message": "Expected initialAnnouncement to be type of [GENERAL_ANNOUNCEMENT] but was [MUSIC_ON_HOLD]",
    "path": "initialAnnouncement"
  }]
}
Customer should not be able to update Position Announcement Interval in Customer Options when value is too low
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I try to change a skill /api/customers/K0002/targets/skill-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
And Content-Type header should be application/api-problem+json
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 skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I try to change a skill /api/customers/K0002/targets/skill-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
And Content-Type header should be application/api-problem+json
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 skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I try to change a skill /api/customers/K0002/targets/skill-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
And Content-Type header should be application/api-problem+json
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 skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as customer K0002
When I try to change a skill /api/customers/K0002/targets/skill-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
And Content-Type header should be application/api-problem+json
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 Skill
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given there is no skill service with 404 identifier
and I am authenticated as customer K0002
When I try to change a skill /api/customers/K0002/targets/skill-services/404
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": "Skill service not found",
  "detail": "Skill service with serviceNumber 404 not found",
  "described_by": "http://api.nfon.net/probs/skill-service-not-found"
}
Missing Customer
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Admin
When I try to change a skill with PUT request /api/customers/K404/targets/skill-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 Skill Service
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
and I am authenticated as Customer K0003
When I try to change a skill with PUT request /api/customers/K0002/targets/skill-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 Skill Service of Customer that does not belong to him
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as System Integrator S0002
When I try to change a skill with PUT request /api/customers/K0003/targets/skill-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": []
}
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 cannot update Skill Service of Customer that does not belong to him
Test setup
Given there is a skill service
  • with name skill name
  • with service number 345
  • and asterisk extension number 576
Given I am authenticated as Operator C0002
When I try to change a skill with PUT request /api/customers/K0003/targets/skill-services/345
as application/json; charset=UTF-8
with following body:
{
  "data": []
}
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"
}