Api >

Service Portal REST API

POST creates Softswitch with all properties
Given I am authenticated as Admin
and there is a Softswitch with id: 100
And next Softswitch ID will be 200
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "failoverSoftswitch",
    "href": "/api/operators/C0002/softswitches/100"
  }],
  "data": [{
    "name": "name",
    "value": "SoftswitchName1"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "selectableByOperator",
    "value": true
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }, {
    "name": "trunkExtensionAvailable",
    "value": true
  }, {
    "name": "privateUse",
    "value": true
  }, {
    "name": "primaryCodec",
    "value": "codec"
  }]
}
Then I should receive HTTP/1.1 201 Created
with http://localhost:9998/api/operators/C0002/softswitches/200 and following body:
{
  "href": "/api/operators/C0002/softswitches/200"
}

Given I am authenticated as Admin
When I send /api/operators/C0002/softswitches/200
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/operators/C0002/softswitches/200",
  "links": [{
    "rel": "failoverSoftswitch",
    "href": "/api/operators/C0002/softswitches/100"
  }],
  "data": [{
    "name": "name",
    "value": "SoftswitchName1"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "selectableByOperator",
    "value": true
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }, {
    "name": "trunkExtensionAvailable",
    "value": true
  }, {
    "name": "privateUse",
    "value": true
  }, {
    "name": "primaryCodec",
    "value": "codec"
  }]
}
POST creates Softswitch with required properties
Given I am authenticated as Admin
And next Softswitch ID will be 200
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "SoftswitchName1"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
Then I should receive HTTP/1.1 201 Created

Given I am authenticated as Admin
When I send /api/operators/C0002/softswitches/200
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/operators/C0002/softswitches/200",
  "data": [{
    "name": "name",
    "value": "SoftswitchName1"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
Cannot create Softswitch with an existing name
Given I am authenticated as Admin
and there is a Softswitch with name: SoftswitchName1
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "SoftswitchName1"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
and following body:
{
  "errors": [{
    "message": "Softswitch with name [SoftswitchName1] already exists for Operator [C0002]",
    "value": null
  }]
}
Cannot create Softswitch if required properties are empty
Given I am authenticated as Admin
And next Softswitch ID will be 200
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": ""
  }, {
    "name": "identifier",
    "value": null
  }, {
    "name": "cidType",
    "value": null
  }, {
    "name": "dialType",
    "value": null
  }, {
    "name": "privacyType",
    "value": null
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Field cannot be empty",
    "path": "cidType",
    "value": null
  }, {
    "message": "Field cannot be empty",
    "path": "dialType",
    "value": null
  }, {
    "message": "Field cannot be empty",
    "path": "privacyType",
    "value": null
  }, {
    "message": "Field cannot be empty",
    "path": "identifier",
    "value": null
  }, {
    "message": "Field cannot be empty",
    "path": "name",
    "value": ""
  }]
}
Cannot create Softswitch if string properties have invalid length
Given I am authenticated as Admin
And next Softswitch ID will be 200
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long name"
  }, {
    "name": "identifier",
    "value": "long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long name"
  }, {
    "name": "primaryCodec",
    "value": "very long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long identifier"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Length of property cannot be greater than 16",
    "path": "name"
  }, {
    "message": "Length of property cannot be greater than 100",
    "path": "identifier"
  }, {
    "message": "Length of property cannot be greater than 255",
    "path": "primaryCodec"
  }]
}
Cannot create Softswitch if name exceeds 16 characters
Given I am authenticated as Admin
And next Softswitch ID will be 200
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "12345678901234567"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Length of property cannot be greater than 16",
    "path": "name",
    "value": "12345678901234567"
  }]
}
Cannot create Softswitch if enum properties have invalid values
Given I am authenticated as Admin
And next Softswitch ID will be 200
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "name"
  }, {
    "name": "identifier",
    "value": "id"
  }, {
    "name": "cidType",
    "value": "INVALID"
  }, {
    "name": "dialType",
    "value": "INVALID"
  }, {
    "name": "privacyType",
    "value": ""
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Unknown enum value. Allowed values: [ENUM_164_00, ENUM_164_PLUS, ENUM_164_MINUS]",
    "path": "cidType",
    "value": "INVALID"
  }, {
    "message": "Unknown enum value. Allowed values: [ENUM_164_00, ENUM_164_PLUS, ENUM_164_MINUS]",
    "path": "dialType",
    "value": "INVALID"
  }, {
    "message": "Unknown enum value. Allowed values: [ANONYMOUS, UNAVAILABLE, PRIVACY_FULL]",
    "path": "privacyType",
    "value": ""
  }]
}
Can create Softswitch with name at maximum length (16 characters)
Given I am authenticated as Admin
And next Softswitch ID will be 200
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "1234567890123456"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
Then I should receive HTTP/1.1 201 Created

Given I am authenticated as Admin
When I send /api/operators/C0002/softswitches/200
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/operators/C0002/softswitches/200",
  "data": [{
    "name": "name",
    "value": "1234567890123456"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
Cannot create Softswitch if failoverSoftswitch belongs to different Operator
Given I am authenticated as Admin
and there is a Softswitch with ID 100 for Operator C0003
And next Softswitch ID will be 200
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "failoverSoftswitch",
    "href": "/api/operators/C0003/softswitches/100"
  }],
  "data": [{
    "name": "name",
    "value": "name"
  }, {
    "name": "identifier",
    "value": "id"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Softswitch [100] does not belong to Operator [C0002]",
    "path": "failoverSoftswitch",
    "value": "/api/operators/C0003/softswitches/100"
  }]
}
Can create Softswitch with null failoverSoftswitch
Given I am authenticated as Admin
And next Softswitch ID will be 200
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "failoverSoftswitch",
    "href": null
  }],
  "data": [{
    "name": "name",
    "value": "name"
  }, {
    "name": "identifier",
    "value": "id"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
Then I should receive HTTP/1.1 201 Created

Given I am authenticated as Admin
When I send /api/operators/C0002/softswitches/200
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/operators/C0002/softswitches/200",
  "links": [{
    "rel": "failoverSoftswitch",
    "href": null
  }]
}
POST returns 404 if Operator is missing
Given I am authenticated as Admin
and there is no Operator with id C0404 When I send /api/operators/C0404/softswitches
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "SoftswitchName1"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
Then I should receive HTTP/1.1 404 Not Found with following body:
{
  "detail": "Operator C0404 has not been found",
  "title": "Operator not found",
  "described_by": "http://api.nfon.net/probs/operator-not-found"
}
Customer cannot create Softswitch
Given I am authenticated as Customer C0003
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "SoftswitchName1"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
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 [Operator] with id [C0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator cannot create Softswitch
Given I am authenticated as System Integrator S0002
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "SoftswitchName1"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden
with following body
{
  "title": "Access forbidden",
  "detail": "Access denied to [Operator] with id [C0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Operator cannot create Softswitch
Given I am authenticated as Operator C0002
When I send /api/operators/C0002/softswitches
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "SoftswitchName1"
  }, {
    "name": "identifier",
    "value": "dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_00"
  }, {
    "name": "dialType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "privacyType",
    "value": "ANONYMOUS"
  }]
}
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"
}