Api >

Service Portal REST API

PUT updates Customer's Operator Details settings
Given I am authenticated as Operator C0002
and there is a New Pbx Group that belongs to Operator C0002 and is attached to New Sip Server with Id 15
When I send /api/customers/K0002/operator-details
with application/json; charset=UTF-8
and body
{
  "links": [{
    "rel": "pbxGroup",
    "href": "/api/operators/C0002/pbx-groups/New%20Pbx%20Group"
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as Operator C0002
When I send /api/customers/K0002/operator-details
Then I should receive HTTP/1.1 200 OK
with following body
{
  "href": "/api/customers/K0002/operator-details",
  "links": [{
    "rel": "systemIntegrator",
    "href": "/api/system-integrators/S0002"
  }, {
    "rel": "pbxGroup",
    "href": "/api/operators/C0002/pbx-groups/New%20Pbx%20Group"
  }, {
    "rel": "availablePbxGroups",
    "href": "/api/customers/K0002/available-pbx-groups"
  }],
  "data": [{
    "name": "operator",
    "value": "C0002"
  }, {
    "name": "operatorName",
    "value": "C0002"
  }, {
    "name": "systemIntegrator",
    "value": "S0002"
  }, {
    "name": "systemIntegratorName",
    "value": "S0002"
  }, {
    "name": "pbxGroupName",
    "value": "New Pbx Group"
  }, {
    "name": "sipServerName",
    "value": "New Sip Server"
  }]
}

And given I am authenticated as Admin
When I send /api/customers/K0002/operator-details
Then I should receive HTTP/1.1 200 OK
with following body
{
  "href": "/api/customers/K0002/operator-details",
  "links": [{
    "rel": "operator",
    "href": "/api/operators/C0002"
  }, {
    "rel": "systemIntegrator",
    "href": "/api/system-integrators/S0002"
  }, {
    "rel": "pbxGroup",
    "href": "/api/operators/C0002/pbx-groups/New%20Pbx%20Group"
  }, {
    "rel": "sipServer",
    "href": "/api/sip-servers/15"
  }, {
    "rel": "availablePbxGroups",
    "href": "/api/customers/K0002/available-pbx-groups"
  }],
  "data": [{
    "name": "operator",
    "value": "C0002"
  }, {
    "name": "operatorName",
    "value": "C0002"
  }, {
    "name": "systemIntegrator",
    "value": "S0002"
  }, {
    "name": "systemIntegratorName",
    "value": "S0002"
  }, {
    "name": "pbxGroupName",
    "value": "New Pbx Group"
  }, {
    "name": "sipServerName",
    "value": "New Sip Server"
  }]
}
Cannot update Customer's Operator Details settings with invalid Pbx Group
Given I am authenticated as Operator C0002
and there is a New Pbx Group that belongs to Operator C0002 and does not have any Sip Servers
When I send /api/customers/K0002/operator-details
with application/json; charset=UTF-8
and body
{
  "links": [{
    "rel": "pbxGroup",
    "href": "/api/operators/C0002/pbx-groups/New%20Pbx%20Group"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Pbx Group [New Pbx Group] is not allowed for Customer [K0002]",
    "path": "pbxGroup",
    "value": "/api/operators/C0002/pbx-groups/New%20Pbx%20Group"
  }]
}
Operator cannot update Customer's Operator Details settings with Pbx Group that belongs to different Operator
Given I am authenticated as Operator C0002
and there is a New Pbx Group that belongs to Operator C0003 and does not have any Sip Servers
When I send /api/customers/K0002/operator-details
with application/json; charset=UTF-8
and body
{
  "links": [{
    "rel": "pbxGroup",
    "href": "/api/operators/C0003/pbx-groups/New%20Pbx%20Group"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden
with following body
{
  "title": "Access forbidden",
  "detail": "Access denied to [Operator] with id [C0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Cannot change Operator Details settings
Given I am authenticated as System Integrator S0002
And there is A Pbx Group
When I send /api/customers/K0002/operator-details
with application/json; charset=UTF-8
and body
{
  "links": [{
    "rel": "pbxGroup",
    "href": "/api/operators/C0002/pbx-groups/A%20Pbx%20Group"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden
with following body
{
  "detail": "Required role is missing",
  "title": "Access forbidden",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Missing Customer
Given I am authenticated as admin
and there is no Customer K0404 And there is A Pbx Group
When I send /api/customers/K0404/operator-details
with application/json; charset=UTF-8
and body
{
  "links": [{
    "rel": "pbxGroup",
    "href": "/api/operators/C0002/pbx-groups/A%20Pbx%20Group"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
with following body
{
  "title": "Customer not found",
  "detail": "Customer with identifier K0404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Customer cannot change other Customer's Operator Details settings
Given I am authenticated as Customer K0002
And there is A Pbx Group
When I send /api/customers/K0003/operator-details
with application/json; charset=UTF-8
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"
}
System Integrator cannot change Operator Details settings of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
And there is A Pbx Group
When I send /api/customers/K0003/operator-details
with application/json; charset=UTF-8
and body
{
  "links": [{
    "rel": "pbxGroup",
    "href": "/api/operators/C0002/pbx-groups/A%20Pbx%20Group"
  }]
}
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 change Operator Details settings of Customer that does not belong to him
Given I am authenticated as Operator C0002
And there is A Pbx Group
When I send /api/customers/K0003/operator-details
with application/json; charset=UTF-8
and body
{
  "links": [{
    "rel": "pbxGroup",
    "href": "/api/operators/C0002/pbx-groups/A%20Pbx%20Group"
  }]
}
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"
}