Api >

Service Portal REST API

Customer should be able to create the skill service
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "memberAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }],
  "data": [{
    "name": "displayName",
    "value": "some 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
  }, {
    "name": "periodicAnnouncementInterval",
    "value": 45
  }, {
    "name": "positionAnnouncementInterval",
    "value": 89
  }]
}
Then I should receive HTTP/1.1 201 Created
with http://localhost:9998/api/customers/K0002/targets/skill-services/0 and body:
{
  "href": "/api/customers/K0002/targets/skill-services/0"
}
Given I am authenticated as customer K0002
When I ask for a skill /api/customers/K0002/targets/skill-services/0
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/0",
  "links": [{
    "rel": "customer",
    "href": "/api/customers/K0002"
  }, {
    "rel": "memberAnnouncement",
    "href": "/api/customers/K0002/announcements/1010"
  }, {
    "rel": "members",
    "href": "/api/customers/K0002/targets/skill-services/0/members"
  }, {
    "rel": "inboundTrunkNumbers",
    "href": "/api/customers/K0002/targets/skill-services/0/inbound-trunk-numbers"
  }],
  "data": [{
    "name": "displayName",
    "value": "some display name"
  }, {
    "name": "extensionNumber",
    "value": "12345"
  }, {
    "name": "direction",
    "value": "INBOUND"
  }, {
    "name": "weight",
    "value": 3
  }, {
    "name": "ringType",
    "value": "RING"
  }, {
    "name": "selectionStrategy",
    "value": "ROUND_ROBIN"
  }, {
    "name": "retryTimeout",
    "value": 11
  }, {
    "name": "reportHoldTime",
    "value": true
  }, {
    "name": "memberTimeout",
    "value": 22
  }, {
    "name": "memberWrapUpTime",
    "value": 33
  }, {
    "name": "periodicAnnouncementInterval",
    "value": 45
  }, {
    "name": "positionAnnouncementInterval",
    "value": 89
  }]
}
Should not create an outbound skill service with property 'periodicAnnouncementInterval' set
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "some display name"
  }, {
    "name": "extensionNumber",
    "value": "12345"
  }, {
    "name": "weight",
    "value": 3
  }, {
    "name": "direction",
    "value": "OUTBOUND"
  }, {
    "name": "periodicAnnouncementInterval",
    "value": 11
  }]
}
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": "periodicAnnouncementInterval",
    "value": 11
  }]
}
Should not create an outbound skill service with property 'positionAnnouncementInterval' set
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "some display name"
  }, {
    "name": "extensionNumber",
    "value": "12345"
  }, {
    "name": "weight",
    "value": 3
  }, {
    "name": "direction",
    "value": "OUTBOUND"
  }, {
    "name": "positionAnnouncementInterval",
    "value": 11
  }]
}
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": "positionAnnouncementInterval",
    "value": 11
  }]
}
Should not create a skill service without a 'displayName'
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "extensionNumber",
    "value": "12345"
  }, {
    "name": "weight",
    "value": 3
  }, {
    "name": "direction",
    "value": "INBOUND"
  }]
}
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 is missing",
    "path": "displayName"
  }]
}
Should not create a skill service using a displayName that contains invalid characters
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "is this new name?"
  }, {
    "name": "extensionNumber",
    "value": "12345"
  }, {
    "name": "weight",
    "value": 3
  }, {
    "name": "direction",
    "value": "INBOUND"
  }]
}
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": "is this new name?"
  }]
}
Should not create a skill service using a displayName with invalid length
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "this is a way, way, way, way, way, way, way, way, way to long displayName"
  }, {
    "name": "extensionNumber",
    "value": "12345"
  }, {
    "name": "weight",
    "value": 3
  }, {
    "name": "direction",
    "value": "INBOUND"
  }]
}
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 have a length between 1 and 50 characters",
    "path": "displayName",
    "value": "this is a way, way, way, way, way, way, way, way, way to long displayName"
  }]
}
Should not create a skill service without a 'extension number'
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "name"
  }, {
    "name": "weight",
    "value": 3
  }, {
    "name": "direction",
    "value": "INBOUND"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as customer K0002
When I ask for a skill /api/customers/K0002/targets/skill-services/0
Then I should receive HTTP/1.1 200 OK
Should not create a skill service using an extension number with invalid format
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": " displayName"
  }, {
    "name": "extensionNumber",
    "value": "0123"
  }, {
    "name": "weight",
    "value": 3
  }, {
    "name": "direction",
    "value": "INBOUND"
  }]
}
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": "Invalid extension number format. Must not start with the dial-out-prefix (default 0)",
    "path": "extensionNumber",
    "value": "0123"
  }]
}
Should not create a skill service using too long extension number
Given I am authenticated as customer K0002
and there is an GENERAL_ANNOUNCEMENT announcement with ID 1010
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": " displayName"
  }, {
    "name": "extensionNumber",
    "value": "12345678901234567890123456789"
  }, {
    "name": "weight",
    "value": 3
  }, {
    "name": "direction",
    "value": "INBOUND"
  }]
}
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": "Extension number length should not exceed 20 characters",
    "path": "extensionNumber",
    "value": "12345678901234567890123456789"
  }]
}
Should not create a skill service using duplicate extension number
Given I am authenticated as customer K0002
and there is already an extension with extension number 12345 When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "some display name"
  }, {
    "name": "extensionNumber",
    "value": "12345"
  }, {
    "name": "weight",
    "value": 0
  }, {
    "name": "direction",
    "value": "INBOUND"
  }]
}
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": "Extension number is not unique.",
    "path": "extensionNumber",
    "value": "12345"
  }]
}
Should create a Skill Service with default values
Given I am authenticated as customer K0002
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "some display name"
  }, {
    "name": "direction",
    "value": "INBOUND"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as customer K0002
When I ask for a skill /api/customers/K0002/targets/skill-services/0
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/0",
  "links": [{
    "rel": "customer",
    "href": "/api/customers/K0002"
  }],
  "data": [{
    "name": "displayName",
    "value": "some display name"
  }, {
    "name": "direction",
    "value": "INBOUND"
  }, {
    "name": "weight",
    "value": 0
  }, {
    "name": "ringType",
    "value": "DEFAULT"
  }, {
    "name": "selectionStrategy",
    "value": "RING_ALL"
  }]
}
Should not create a skill service with invalid weight value
Given I am authenticated as customer K0002
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "some display name"
  }, {
    "name": "weight",
    "value": 1410
  }, {
    "name": "direction",
    "value": "INBOUND"
  }]
}
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": "Weight should have a value between 0 and 255",
    "path": "weight",
    "value": 1410
  }]
}
Should create a skill service with default timeout
Given I am authenticated as customer K0002
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "some display name"
  }, {
    "name": "direction",
    "value": "INBOUND"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as customer K0002
When I ask for a skill /api/customers/K0002/targets/skill-services/0/timeout
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/0/timeout",
  "links": [{
    "rel": "availableDestinations",
    "href": "/api/customers/K0002/targets/skill-services/available-destinations-on-timeout"
  }, {
    "rel": "destinationOnTimeout",
    "href": "/api/customers/K0002/targets/NO_ACTION"
  }],
  "data": [{
    "name": "timeoutDelay",
    "value": 0
  }]
}
Should not create a skill service with negative retryTimeout
Given I am authenticated as customer K0002
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "displayName"
  }, {
    "name": "direction",
    "value": "INBOUND"
  }, {
    "name": "retryTimeout",
    "value": -3
  }]
}
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": "retryTimeout",
    "value": -3
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Should not create a skill service with memberTimeout exceeding the limit
Given I am authenticated as customer K0002
When I try to create a skill /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "displayName"
  }, {
    "name": "direction",
    "value": "INBOUND"
  }, {
    "name": "memberTimeout",
    "value": 1000000
  }]
}
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": "memberTimeout",
    "value": 1000000
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Should not create a Skill Service with null memberWrapUpTime
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/skill-services
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "displayName"
  }, {
    "name": "direction",
    "value": "INBOUND"
  }, {
    "name": "memberWrapUpTime",
    "value": null
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "memberWrapUpTime cannot be null",
    "path": "memberWrapUpTime",
    "value": null
  }]
}
Missing Customer
Given I am authenticated as Admin
When I try to create a skill /api/customers/K404/targets/skill-services
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 create another Customer's Skill Services
Given I am authenticated as Customer K0003
When I try to create a skill /api/customers/K0002/targets/skill-services
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 create Skill Services for Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I try to create a skill /api/customers/K0003/targets/skill-services
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 create Skill Services for Customer that does not belong to him
Given I am authenticated as Operator C0002
When I try to create a skill /api/customers/K0003/targets/skill-services
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"
}