Api >

Service Portal REST API

PUT updates Softswitch data
Given I am authenticated as Admin
and there is a Softswitch with id: 100 and:
  • name: SoftswitchName1
  • identifier: dns
  • cidType: ENUM_164_00
  • dialType: ENUM_164_PLUS
  • privacyType: ANONYMOUS
  • trunkExtensionAvailable: true
  • privateUse: true
  • primaryCodec: codec
  • failoverSoftswitch with ID 200
and there is another Softswitch with id: 300 and: When I send /api/operators/C0002/softswitches/100
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "failoverSoftswitch",
    "href": "/api/operators/C0002/softswitches/300"
  }],
  "data": [{
    "name": "name",
    "value": "new name"
  }, {
    "name": "identifier",
    "value": "new dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "dialType",
    "value": "ENUM_164_00"
  }, {
    "name": "selectableByOperator",
    "value": true
  }, {
    "name": "privacyType",
    "value": "UNAVAILABLE"
  }, {
    "name": "trunkExtensionAvailable",
    "value": false
  }, {
    "name": "privateUse",
    "value": false
  }, {
    "name": "primaryCodec",
    "value": "new codec"
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as Admin
When I send /api/operators/C0002/softswitches/100
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/operators/C0002/softswitches/100",
  "links": [{
    "rel": "failoverSoftswitch",
    "href": "/api/operators/C0002/softswitches/300"
  }],
  "data": [{
    "name": "name",
    "value": "new name"
  }, {
    "name": "identifier",
    "value": "new dns"
  }, {
    "name": "cidType",
    "value": "ENUM_164_PLUS"
  }, {
    "name": "dialType",
    "value": "ENUM_164_00"
  }, {
    "name": "selectableByOperator",
    "value": true
  }, {
    "name": "privacyType",
    "value": "UNAVAILABLE"
  }, {
    "name": "trunkExtensionAvailable",
    "value": false
  }, {
    "name": "privateUse",
    "value": false
  }, {
    "name": "primaryCodec",
    "value": "new codec"
  }]
}
Cannot update Softswitch with empty required properties
Given I am authenticated as Admin
and there is a Softswitch with id: 100
When I send /api/operators/C0002/softswitches/100
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": ""
  }]
}
PUT cannot update Softswitch with existing name
Given I am authenticated as Admin
There is a Softswitch with id: 100
Also there is an existing Softswitch with name SoftswitchName1
When I send /api/operators/C0002/softswitches/100
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "SoftswitchName1"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Softswitch with name [SoftswitchName1] already exists for Operator [C0002]",
    "value": null
  }]
}
Cannot update Softswitch if string properties have invalid length
Given I am authenticated as Admin
and there is a Softswitch with id: 100
When I send /api/operators/C0002/softswitches/100
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"
  }]
}
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 update Softswitch if name exceeds 16 characters
Given I am authenticated as Admin
and there is a Softswitch with id: 100
When I send /api/operators/C0002/softswitches/100
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "12345678901234567"
  }]
}
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"
  }]
}
Can update Softswitch with name at maximum length (16 characters)
Given I am authenticated as Admin
and there is a Softswitch with id: 100
When I send /api/operators/C0002/softswitches/100
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "name",
    "value": "9876543210654321"
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as Admin
When I send /api/operators/C0002/softswitches/100
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/operators/C0002/softswitches/100",
  "data": [{
    "name": "name",
    "value": "9876543210654321"
  }]
}
Cannot update Softswitch if enum properties have invalid values
Given I am authenticated as Admin
and there is a Softswitch with id: 100
When I send /api/operators/C0002/softswitches/100
with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "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": ""
  }]
}
Cannot update Softswitch if failoverSoftswitch belongs to different Operator
Given I am authenticated as Admin
and there is a Softswitch with id: 100
and there is a Softswitch with ID 200 for Operator C0003
When I send /api/operators/C0002/softswitches/100
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "failoverSoftswitch",
    "href": "/api/operators/C0003/softswitches/200"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Softswitch [200] does not belong to Operator [C0002]",
    "path": "failoverSoftswitch",
    "value": "/api/operators/C0003/softswitches/200"
  }]
}
Cannot update Softswitch if failoverSoftswitch is the same softswitch as the given one
Given I am authenticated as Admin
and there is a Softswitch with id: 100
When I send /api/operators/C0002/softswitches/100
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "failoverSoftswitch",
    "href": "/api/operators/C0002/softswitches/100"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "failoverSoftswitch cannot be the same as current Softswitch",
    "path": "failoverSoftswitch",
    "value": "/api/operators/C0002/softswitches/100"
  }]
}
Can update Softswitch with null failoverSoftswitch
Given I am authenticated as Admin
and there is a Softswitch with id: 100
When I send /api/operators/C0002/softswitches/100
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "failoverSoftswitch",
    "href": null
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as Admin
When I send /api/operators/C0002/softswitches/100
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/operators/C0002/softswitches/100",
  "links": [{
    "rel": "failoverSoftswitch",
    "href": null
  }]
}
PUT returns 404 if Softswitch does not belong to the given Operator
Given I am authenticated as Admin
and there is another Softswitch with id: 100 that belongs to Operator C0003
When I send /api/operators/C0002/softswitches/100
with application/json; charset=UTF-8 and following body:
{}
Then I should receive HTTP/1.1 404 Not Found with following body:
{
  "detail": "Softswitch with ID 100 has not been found",
  "title": "Softswitch not found",
  "described_by": "http://api.nfon.net/probs/softswitch-not-found"
}
PUT returns 404 if Softswitch is missing
Given I am authenticated as Admin
and there is no Softswitch with id 404 When I send /api/operators/C0002/softswitches/404
with application/json; charset=UTF-8 and following body:
{}
Then I should receive HTTP/1.1 404 Not Found with following body:
{
  "detail": "Softswitch with ID 404 has not been found",
  "title": "Softswitch not found",
  "described_by": "http://api.nfon.net/probs/softswitch-not-found"
}
PUT 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/100
with application/json; charset=UTF-8 and following body:
{}
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 update Softswitch
Given I am authenticated as Customer C0003
When I send /api/operators/C0002/softswitches/100
with application/json; charset=UTF-8 and following body:
{}
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 update Softswitch
Given I am authenticated as System Integrator S0002
When I send /api/operators/C0002/softswitches/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": "Access denied to [Operator] with id [C0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Operator cannot update Softswitch
Given I am authenticated as Operator C0002
When I send /api/operators/C0002/softswitches/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"
}