Api >

Service Portal REST API

GET returns all Customer's Blacklist Profiles
Given I am authenticated as customer K0002
and there is a Blacklist Profile with id 123 and name Test Blacklist Profile
When I send /api/customers/K0002/blacklist-profiles
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/blacklist-profiles?_offset=0&_pagesize=16",
  "total": 6,
  "size": 6,
  "offset": 0,
  "items": [{
    "href": "/api/customers/K0002/blacklist-profiles/123",
    "data": [{
      "name": "name",
      "value": "Test Blacklist Profile"
    }]
  }, {
    "data": [{
      "name": "name",
      "value": "Custom"
    }]
  }, {
    "data": [{
      "name": "name",
      "value": "Intern"
    }]
  }, {
    "data": [{
      "name": "name",
      "value": "International"
    }]
  }, {
    "data": [{
      "name": "name",
      "value": "Local"
    }]
  }, {
    "data": [{
      "name": "name",
      "value": "National"
    }]
  }, {
    "data": [{
      "name": "name",
      "value": "Custom"
    }]
  }]
}
GET returns filtered Customer's Blacklist Profiles
Filtering is done on fields :
  • name
Given I am authenticated as customer K0002
and there is a Blacklist Profile with id 123 and name Test Blacklist Profile
When I send /api/customers/K0002/blacklist-profiles?_q=nation
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/blacklist-profiles?_offset=0&_pagesize=16&_q=nation",
  "total": 2,
  "size": 2,
  "offset": 0,
  "items": [{
    "data": [{
      "name": "name",
      "value": "International"
    }]
  }, {
    "data": [{
      "name": "name",
      "value": "National"
    }]
  }]
}
GET returns 404 if customer is missing
Given I am authenticated as Admin
and there is no customer with id K0404 When I send /api/customers/K0404/blacklist-profiles
Then I should receive HTTP/1.1 404 Not Found with following body:
{
  "described_by": "http://api.nfon.net/probs/customer-not-found",
  "title": "Customer not found",
  "detail": "Customer with identifier K0404 has not been found"
}
Customer should not be able to GET another Customer's Blacklist Profiles
Given I am authenticated as Customer K0003
When I send /api/customers/K0002/blacklist-profiles
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 [Customer] with id [K0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator cannot access Blacklist Profiles of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/blacklist-profiles
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 Blacklist Profiles of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/blacklist-profiles
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"
}