Api >

Service Portal REST API

POST assigns Rating Profile
Given I am authenticated as Admin
and there is rating profile with name 8 description description 8
which is not assigned to Operator C0002
When I send /api/operators/C0002/rating-profiles with application/json; charset=UTF-8 and body
{
  "data": [{
    "name": "name",
    "value": "8"
  }]
}
Then I should receive HTTP/1.1 201 Created

Given I am authenticated as Admin
When I send /api/operators/C0002/rating-profiles/8 Then I should receive HTTP/1.1 200 OK with body
{
  "data": [{
    "name": "name",
    "value": "8"
  }, {
    "name": "description",
    "value": "description 8"
  }]
}
POST does not assign not existing Rating Profile
Given I am authenticated as Admin
and there is no rating profile with name 8
When I send /api/operators/C0002/rating-profiles with application/json; charset=UTF-8 and body
{
  "data": [{
    "name": "name",
    "value": "8"
  }]
}
Then I should receive HTTP/1.1 404 Not Found with body
{
  "detail": "Rating Profile 8 has not been found",
  "title": "Rating Profile not found",
  "described_by": "http://api.nfon.net/probs/rating-profile-not-found"
}
POST does not assign the same Rating Profile twice
Given I am authenticated as Admin
and there is rating profile with name 8 description description 8
which is assigned to Operator C0002
When I send /api/operators/C0002/rating-profiles with application/json; charset=UTF-8 and body
{
  "data": [{
    "name": "name",
    "value": "8"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with body
{
  "errors": [{
    "message": "Rating Profile 8 has already been assigned to Operator C0002"
  }]
}
First Rating Profile assigned to the Operator is his default Rating Profile
Given I am authenticated as Admin
and there is rating profile with name 8
and Operator C0002 does not have any Rating Profiles assigned
When I send /api/operators/C0002/rating-profiles with application/json; charset=UTF-8 and body
{
  "data": [{
    "name": "name",
    "value": "8"
  }]
}
Then I should receive HTTP/1.1 201 Created

Given I am authenticated as Admin
When I send /api/operators/C0002 Then I should receive HTTP/1.1 200 OK with body
{
  "links": [{
    "rel": "defaultRatingProfile",
    "href": "/api/operators/C0002/rating-profiles/8"
  }]
}
Fails meaningfully when trying to assign rating profile to not existing Operator
Given I am authenticated as Admin
When I send /api/operators/C404/rating-profiles with application/json; charset=UTF-8
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "detail": "Operator C404 has not been found",
  "title": "Operator not found",
  "described_by": "http://api.nfon.net/probs/operator-not-found"
}
Customer cannot assign rating profiles
Given I am authenticated as customer K0002
When I send /api/operators/C0002/rating-profiles with application/json; charset=UTF-8
Then I should receive HTTP/1.1 403 Forbidden
And Content-Type header should be application/api-problem+json
with following body:
{
  "detail": "Access denied to [Operator] with id [C0002]",
  "title": "Access forbidden",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator cannot assign rating profiles
Given I am authenticated as System Integrator S0002
When I send /api/operators/C0002/rating-profiles with application/json; charset=UTF-8
Then I should receive HTTP/1.1 403 Forbidden
And Content-Type header should be application/api-problem+json
with following body:
{
  "detail": "Access denied to [Operator] with id [C0002]",
  "title": "Access forbidden",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Operator cannot assign rating profiles
Given I am authenticated as Operator C0002
When I send /api/operators/C0002/rating-profiles with application/json; charset=UTF-8 and body
{
  "data": [{
    "name": "name",
    "value": "8"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden
And Content-Type header should be application/api-problem+json
with following body:
{
  "detail": "Required role is missing",
  "title": "Access forbidden",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}