Api >

Service Portal REST API

Admin can update Sip Server
Given I am authenticated as Admin
and there is a Pbx Group with name Pbx1
and there is another Pbx Group with name Pbx2
And there is a Sip Server with:
  • ID: 100
  • name: sipServerName
  • externalIp: 192.168.1.1
  • externalIp: 192.168.1.2
  • location: Location
  • pbxGroup with name Pbx1
  • description: 4xE5504-2GHZ;4GB
  • partition: P01
  • maxSubscribers: 1000
  • maxSubscribers: 500
When I send /api/sip-servers/100
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "pbxGroup",
    "href": "/api/pbx-groups/Pbx2"
  }],
  "data": [{
    "name": "name",
    "value": "newName"
  }, {
    "name": "externalIp",
    "value": "192.168.1.3"
  }, {
    "name": "internalIp",
    "value": "192.168.1.4"
  }, {
    "name": "maxSubscribers",
    "value": 500
  }, {
    "name": "subscribersLimit",
    "value": 1000
  }, {
    "name": "location",
    "value": "new Location"
  }, {
    "name": "partition",
    "value": "P02"
  }, {
    "name": "description",
    "value": "4xE5504-2GHZ;8GB"
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as Admin
When I send /api/sip-servers/100
Then I should receive HTTP/1.1 200 OK
with body:
{
  "href": "/api/sip-servers/100",
  "links": [{
    "rel": "pbxGroup",
    "href": "/api/pbx-groups/Pbx2"
  }, {
    "rel": "availablePbxGroup",
    "href": "/api/pbx-groups"
  }],
  "data": [{
    "name": "name",
    "value": "newName"
  }, {
    "name": "externalIp",
    "value": "192.168.1.3"
  }, {
    "name": "internalIp",
    "value": "192.168.1.4"
  }, {
    "name": "maxSubscribers",
    "value": 500
  }, {
    "name": "subscribersLimit",
    "value": 1000
  }, {
    "name": "location",
    "value": "new Location"
  }, {
    "name": "partition",
    "value": "P02"
  }, {
    "name": "description",
    "value": "4xE5504-2GHZ;8GB"
  }]
}
Admin cannot update Sip Server if maxSubscribers has incorrect value
Given I am authenticated as Admin
and there is a Pbx Group with name Pbx1
And there is a Sip Server with:
  • ID: 100
  • name: sipServerName
  • externalIp: 192.168.1.1
  • externalIp: 192.168.1.2
  • location: Location
  • pbxGroup with name Pbx1
  • description: 4xE5504-2GHZ;4GB
  • partition: P01
  • maxSubscribers: 1000
  • maxSubscribers: 500
When I send /api/sip-servers/100
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "maxSubscribers",
    "value": -10000000
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
and following body:
{
  "errors": [{
    "message": "maxSubscribers must be greater than or equal -10000",
    "path": "maxSubscribers",
    "value": -10000000
  }]
}
Admin cannot update Sip Server if subscribersLimit has incorrect value
Given I am authenticated as Admin
and there is a Pbx Group with name Pbx1
And there is a Sip Server with:
  • ID: 100
  • name: sipServerName
  • externalIp: 192.168.1.1
  • externalIp: 192.168.1.2
  • location: Location
  • pbxGroup with name Pbx1
  • description: 4xE5504-2GHZ;4GB
  • partition: P01
  • maxSubscribers: 1000
  • maxSubscribers: 500
When I send /api/sip-servers/100
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "subscribersLimit",
    "value": 0
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
and following body:
{
  "errors": [{
    "message": "subscribersLimit must be greater than 0",
    "path": "subscribersLimit",
    "value": 0
  }]
}
Admin cannot update Sip Server if name is not unique
Given I am authenticated as Admin
and there is a Pbx Group with name Pbx1
And there is a Sip Server with:
  • ID: 100
  • name: name
  • externalIp: 192.168.1.1
  • externalIp: 192.168.1.2
  • location: Location
  • pbxGroup with name Pbx1
  • description: 4xE5504-2GHZ;4GB
  • partition: P01
  • maxSubscribers: 1000
  • maxSubscribers: 500
And there is a Sip Server with name: sipServerName
When I send /api/sip-servers/100
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "sipServerName"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
and following body:
{
  "errors": [{
    "message": "name is not unique",
    "path": "name",
    "value": "sipServerName"
  }]
}
Admin cannot update Sip Server if pbxGroup has invalid value - belongs to different endpoint
Given I am authenticated as Admin
and there is a Pbx Group with name Pbx1 which is assigned to Operator C0002
and there is another Pbx Group with name Pbx2
And there is a Sip Server with:
  • ID: 100
  • name: sipServerName
  • externalIp: 192.168.1.1
  • externalIp: 192.168.1.2
  • location: Location
  • pbxGroup with name Pbx1
  • description: 4xE5504-2GHZ;4GB
  • partition: P01
  • maxSubscribers: 1000
  • maxSubscribers: 500
When I send /api/sip-servers/100
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "pbxGroup",
    "href": "/api/operators/C0002/pbx-groups/Pbx1"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
and following body:
{
  "detail": "Resource at /api/operators/C0002/pbx-groups/Pbx1 is of incorrect type",
  "title": "Invalid resource type",
  "described_by": "http://api.nfon.net/probs/invalid-resource-type"
}
Admin cannot update Sip Server if pbxGroup is missing
Given I am authenticated as Admin
and there is a Pbx Group with name Pbx1
And there is a Sip Server with:
  • ID: 100
  • name: sipServerName
  • externalIp: 192.168.1.1
  • externalIp: 192.168.1.2
  • location: Location
  • pbxGroup with name Pbx1
  • description: 4xE5504-2GHZ;4GB
  • partition: P01
  • maxSubscribers: 1000
  • maxSubscribers: 500
When I send /api/sip-servers/100
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "pbxGroup",
    "href": "/api/pbx-groups/Pbx404"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
and following body:
{
  "detail": "Pbx Group with name Pbx404 has not been found",
  "title": "Pbx Group not found",
  "described_by": "http://api.nfon.net/probs/pbx-group-not-found"
}
Admin cannot update Sip Server if pbxGroup is missing
Given I am authenticated as Admin
and there is a Pbx Group with name Pbx1
And there is no Sip Server with ID 404: When I send /api/sip-servers/404
with application/json; charset=UTF-8 and following body:
{}
Then I should receive HTTP/1.1 404 Not Found
and following body:
{
  "detail": "Sip Server with ID 404 has not been found",
  "title": "Sip Server not found",
  "described_by": "http://api.nfon.net/probs/sip-server-not-found"
}
Customer cannot update Sip Server
Given I am authenticated as Customer K0002
When I send /api/sip-servers/100
with application/json; charset=UTF-8 and following body:
{}
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"
}
System Integrator cannot update Sip Server
Given I am authenticated as System Integrator S0002
When I send /api/sip-servers/100
with application/json; charset=UTF-8 and following body:
{}
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"
}
Operator cannot update Sip Server
Given I am authenticated as Operator C0002
When I send /api/sip-servers/100
with application/json; charset=UTF-8 and following body:
{}
Then I should receive HTTP/1.1 403 Forbidden
with following body:
{
  "title": "Access forbidden",
  "detail": "Required role is missing",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}