Api >

Service Portal REST API

Should update a queue service's destination on rejection with not null target if joinEmpty is false
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/destination-on-rejection as application/json; charset=utf-8
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0002/targets/HANGUP"
  }],
  "data": [{
    "name": "joinEmpty",
    "value": false
  }]
}
Then I should receive HTTP/1.1 204 No Content

Then when I send /api/customers/K0002/targets/queue-services/345/destination-on-rejection
Then I should receive HTTP/1.1 200 OK
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0002/targets/HANGUP"
  }],
  "data": [{
    "name": "joinEmpty",
    "value": false
  }]
}
Should not update a destination on rejection to not null target if joinEmpty is true
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/destination-on-rejection as application/json; charset=utf-8
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0002/targets/HANGUP"
  }],
  "data": [{
    "name": "joinEmpty",
    "value": true
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Cannot set destinationOnRejection if joinEmpty is enabled"
  }]
}
Should not update a destination on rejection for OUTBOUND Queue
Given I am authenticated as customer K0002
And there is OUTBOUND queue service with service number 345
When I send /api/customers/K0002/targets/queue-services/345/destination-on-rejection as application/json; charset=utf-8
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0002/targets/HANGUP"
  }],
  "data": [{
    "name": "joinEmpty",
    "value": false
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Operation not allowed for OUTBOUND direction"
  }]
}
Update a destination on rejection to NO_ACTION target - delete destination-on-rejection
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/destination-on-rejection as application/json; charset=utf-8
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0002/targets/NO_ACTION"
  }],
  "data": [{
    "name": "joinEmpty",
    "value": true
  }]
}
Then I should receive HTTP/1.1 204 No Content
Should not update a destination on rejection to not available target
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/destination-on-rejection as application/json; charset=utf-8
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0002/targets/REPEAT"
  }],
  "data": [{
    "name": "joinEmpty",
    "value": true
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Destination on rejection [REPEAT] is not allowed"
  }]
}
Should not update a destination on rejection to null target
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/destination-on-rejection as application/json; charset=utf-8
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": null
  }],
  "data": [{
    "name": "joinEmpty",
    "value": true
  }]
}
Then I should receive HTTP/1.1 204 No Content
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/destination-on-rejection as application/json; charset=utf-8
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0002/targets/HANGUP"
  }],
  "data": [{
    "name": "joinEmpty",
    "value": false
  }]
}
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/destination-on-rejection as application/json; charset=utf-8
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0002/targets/HANGUP"
  }],
  "data": [{
    "name": "joinEmpty",
    "value": false
  }]
}
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 change another Customer's Queue's Destination On Rejection
Given there is a queue service with service number 345
and I am authenticated as Customer K0003
When I send /api/customers/K0002/targets/queue-services/345/destination-on-rejection as application/json; charset=utf-8
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0002/targets/HANGUP"
  }],
  "data": [{
    "name": "joinEmpty",
    "value": false
  }]
}
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 change data of a Customer that he cannot manage
Given there is a queue service with service number 345
and I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/queue-services/345/destination-on-rejection as application/json; charset=utf-8
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0003/targets/HANGUP"
  }],
  "data": [{
    "name": "joinEmpty",
    "value": false
  }]
}
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 change data of a Customer that he cannot manage
Given there is a queue service with service number 345
and I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/queue-services/345/destination-on-rejection as application/json; charset=utf-8
with following body
{
  "links": [{
    "rel": "destinationOnRejection",
    "href": "/api/customers/K0003/targets/HANGUP"
  }],
  "data": [{
    "name": "joinEmpty",
    "value": false
  }]
}
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"
}