Api >

Service Portal REST API

Should create a Queue Member
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 a phone extension with number 712
When I send /api/customers/K0002/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }],
  "data": [{
    "name": "penalty",
    "value": 9
  }]
}
Then I should receive HTTP/1.1 201 Created
with http://localhost:9998/api/customers/K0002/targets/queue-services/345/members/712 and body:
{
  "href": "/api/customers/K0002/targets/queue-services/345/members/712"
}
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345/members/712
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/queue-services/345/members/712",
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }],
  "data": [{
    "name": "penalty",
    "value": 9
  }, {
    "name": "displayName",
    "value": "Extension #712"
  }, {
    "name": "extensionNumber",
    "value": "712"
  }]
}
Should create a Queue Member and set default Penalty
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 a phone extension with number 712
When I send /api/customers/K0002/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345/members/712
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/queue-services/345/members/712",
  "data": [{
    "name": "penalty",
    "value": 0
  }]
}
Cannot set displayName field during creation
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 a phone extension with number 712
When I send /api/customers/K0002/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "new name"
  }],
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "A readonly field is being modified with different value.",
    "path": "displayName",
    "value": "new name"
  }]
}
Cannot set incorrect Penalty
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 a phone extension with number 712
When I send /api/customers/K0002/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "penalty",
    "value": 13
  }],
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "must be less than or equal to 9",
    "path": "penalty",
    "value": "13"
  }]
}
Cannot create member without extension
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/members
as application/json; charset=UTF-8
with following body:
{}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "PhoneExtension is required",
    "path": "phoneExtension",
    "value": null
  }]
}
Cannot create member when trying to set displayName
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 a phone extension with number 712
When I send /api/customers/K0002/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "displayName",
    "value": "new display name"
  }],
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "A readonly field is being modified with different value.",
    "path": "displayName",
    "value": "new display name"
  }]
}
Cannot create member when trying to set extensionNumber
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 a phone extension with number 712
When I send /api/customers/K0002/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "extensionNumber",
    "value": "999"
  }],
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "A readonly field is being modified with different value.",
    "path": "extensionNumber",
    "value": "999"
  }]
}
Should not assign already assigned member
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 a phone extension with number 712
When I send /api/customers/K0002/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as customer K0002
When I send again /api/customers/K0002/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "title": "Queue member already exists",
  "detail": "There is queue member for phone extension: /api/customers/K0002/targets/phone-extensions/712",
  "described_by": "http://api.nfon.net/probs/queue-member-already-exists"
}
Should not assign a phone extension as queue member if it has a queue service outbound queue already
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 queue direction OUTBOUND
and there is a phone extension with number 712
and there is a Queue Service
  • with name outbound queue name
  • with service number 344
  • and asterisk extension number 575
  • and queue direction OUTBOUND
When I send /api/customers/K0002/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 201 Created
with body:
{
  "href": "/api/customers/K0002/targets/queue-services/345/members/712"
}
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/344/members
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "detail": "Could not create or update resource due to constraint violations",
  "title": "Validation error",
  "errors": [{
    "message": "Phone extension is already configured to use an outbound queue. Assigning a second outbound queue isn't possible.",
    "path": "phoneExtension",
    "value": {
      "refId": 10,
      "null": false,
      "notNull": true,
      "id": 10
    }
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Should not assign a phone extension as queue member if it has a skill service outbound queue already
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 queue direction OUTBOUND
and there is a phone extension with number 712
and there is a Skill Service
  • with name outbound skill queue name
  • with service number 344
  • and asterisk extension number 575
  • and queue direction OUTBOUND
When I send /api/customers/K0002/targets/skill-services/344/members
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 201 Created
with http://localhost:9998/api/customers/K0002/targets/skill-services/344/members/712 and body:
{
  "href": "/api/customers/K0002/targets/skill-services/344/members/712",
  "links": [],
  "data": null
}
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "detail": "Could not create or update resource due to constraint violations",
  "title": "Validation error",
  "errors": [{
    "message": "Phone extension is already configured to use an outbound queue. Assigning a second outbound queue isn't possible.",
    "path": "phoneExtension",
    "value": {
      "refId": 10,
      "null": false,
      "notNull": true,
      "id": 10
    }
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Missing Queue
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/members
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
Given I am authenticated as Admin
When I send /api/customers/K404/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "data": []
}
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"
}
Admin should not be able to add queue member with Phone Extension of another Customer
Given I am authenticated as admin
and there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
and there is an another customer with externalIdentifier K0003
and there is a phone extension with number 712 for K0003
When I send with extension that belongs to another customer /api/customers/K0002/targets/queue-services/345/members
as application/json; charset=UTF-8
with following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0003/targets/phone-extensions/712"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "title": "Customers do not match",
  "detail": "Customers do not match",
  "described_by": "http://api.nfon.net/probs/queue-member-customer-do-not-match"
}
Customer should not be able to add members to another Customer's Queue
Given there is a Queue Service
  • with name queue name
  • with service number 345
  • and asterisk extension number 576
and I am authenticated as Customer K0003
When I send /api/customers/K0002/targets/queue-services/345/members
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 [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 576
and I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/queue-services/345/members
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 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 576
and I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/queue-services/345/members
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"
}