Api >

Service Portal REST API

GET retrieves Customer's Router
Given I am authenticated as System Integrator S0002
and next router id is 700
and there is a Router with hostname router01.nfon.net
When I send /api/customers/K0002/routers/700
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/routers/700",
  "links": [],
  "data": [{
    "name": "hostname",
    "value": "router01.nfon.net"
  }, {
    "name": "type",
    "value": "router type"
  }, {
    "name": "comment",
    "value": "router comment"
  }, {
    "name": "monitor",
    "value": false
  }, {
    "name": "manageableInPortal",
    "value": false
  }]
}
Customer cannot see routers
Given I am authenticated as customer K0002
and next router id is 700
and there is a Router with hostname router01.nfon.net
When I ask for a router /api/customers/K0002/routers/700
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": "Required role is missing",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Missing Customer
Given I am authenticated as Admin
When I ask for router for a customer that does not exist /api/customers/K404/routers/700
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Customer not found",
  "detail": "Customer with identifier K404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Missing Router
Given I am authenticated as System Integrator S0002
When I ask for not existing router /api/customers/K0002/routers/404
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Router not found",
  "detail": "Router with ID 404 has not been found",
  "described_by": "http://api.nfon.net/probs/router-not-found"
}
System Integrator cannot access data of Router that does not belong to his Customer
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/routers/700
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 access data of Router that does not belong to his Customer
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/routers/700
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"
}