Api >

Service Portal REST API

GET a list of Customer's Phonebooks
Given I am authenticated as customer K0002
and there is a Phone Book with
  • id: 100
  • number: +49 (66) 1234-555
  • name: Phone Book
  • restricted: true
and there is another Phone Book with
  • id: 200
  • number: +49 (66) 1234-888
  • name: Phone Book 2
  • restricted: false
When I send /api/customers/K0002/phone-books
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/phone-books?_offset=0&_pagesize=16&_orderBy=displayName&_order=ASC",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/phone-books/100",
    "links": [],
    "data": [{
      "name": "phonebookEntryId",
      "value": 100
    }, {
      "name": "displayName",
      "value": "Phone Book"
    }, {
      "name": "displayNumber",
      "value": "+49 (66) 1234-555"
    }, {
      "name": "restricted",
      "value": true
    }]
  }, {
    "href": "/api/customers/K0002/phone-books/200",
    "links": [],
    "data": [{
      "name": "phonebookEntryId",
      "value": 200
    }, {
      "name": "displayName",
      "value": "Phone Book 2"
    }, {
      "name": "displayNumber",
      "value": "+49 (66) 1234-888"
    }, {
      "name": "restricted",
      "value": false
    }]
  }]
}
GET a list of Customer's Phonebooks ordered by number descending
Given I am authenticated as customer K0002
and there is a Phone Book with
  • id: 100
  • number: +49 (66) 1234-555
  • name: Phone Book
  • restricted: true
and there is another Phone Book with
  • id: 200
  • number: +49 (66) 1234-888
  • name: Phone Book 2
  • restricted: false
When I send /api/customers/K0002/phone-books?_orderBy=displayNumber&_order=desc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/phone-books?_offset=0&_pagesize=16&_orderBy=displayNumber&_order=DESC",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/phone-books/200",
    "links": [],
    "data": [{
      "name": "phonebookEntryId",
      "value": 200
    }, {
      "name": "displayName",
      "value": "Phone Book 2"
    }, {
      "name": "displayNumber",
      "value": "+49 (66) 1234-888"
    }, {
      "name": "restricted",
      "value": false
    }]
  }, {
    "href": "/api/customers/K0002/phone-books/100",
    "links": [],
    "data": [{
      "name": "phonebookEntryId",
      "value": 100
    }, {
      "name": "displayName",
      "value": "Phone Book"
    }, {
      "name": "displayNumber",
      "value": "+49 (66) 1234-555"
    }, {
      "name": "restricted",
      "value": true
    }]
  }]
}
GET a filtered list of Customer's Phonebooks using the general full-text query
Filtering is done on fields :
  • displayName
  • displayNumber
Given I am authenticated as customer K0002
and there is a Phone Book with
  • id: 100
  • number: +49 (66) 1234-555
  • name: Phone Book
  • restricted: true
and there is another Phone Book with
  • id: 200
  • number: +49 (66) 1234-888
  • name: Phone Book 2
  • restricted: false
When I send /api/customers/K0002/phone-books?_q=888
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/phone-books?_offset=0&_pagesize=16&_q=888&_orderBy=displayName&_order=ASC",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/phone-books/200",
    "links": [],
    "data": [{
      "name": "phonebookEntryId",
      "value": 200
    }, {
      "name": "displayName",
      "value": "Phone Book 2"
    }, {
      "name": "displayNumber",
      "value": "+49 (66) 1234-888"
    }, {
      "name": "restricted",
      "value": false
    }]
  }]
}
GET a filtered list of Customer's Phonebooks using the specific attribute query
Filtering is done on fields :
  • displayName
Given I am authenticated as customer K0002
and there is a Phone Book with
  • id: 100
  • number: +49 (66) 1234-555
  • name: Phone Book
  • restricted: true
and there is another Phone Book with
  • id: 200
  • number: +49 (66) 1234-888
  • name: Phone Book 2
  • restricted: false
When I send /api/customers/K0002/phone-books?displayName=Phone%20Book%202
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/phone-books?_offset=0&_pagesize=16&_orderBy=displayName&_order=ASC&displayName=Phone+Book+2",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/phone-books/200",
    "links": [],
    "data": [{
      "name": "phonebookEntryId",
      "value": 200
    }, {
      "name": "displayName",
      "value": "Phone Book 2"
    }, {
      "name": "displayNumber",
      "value": "+49 (66) 1234-888"
    }, {
      "name": "restricted",
      "value": false
    }]
  }]
}
GET a filtered list of Customer's Phonebooks using the specific INVERSE attribute query
Filtering is done on fields :
  • displayName
Given I am authenticated as customer K0002
and there is a Phone Book with
  • id: 100
  • number: +49 (66) 1234-555
  • name: Phone Book
  • restricted: true
and there is another Phone Book with
  • id: 200
  • number: +49 (66) 1234-888
  • name: Phone Book 2
  • restricted: false
When I send /api/customers/K0002/phone-books?displayName=!Phone%20Book%202
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/phone-books?_offset=0&_pagesize=16&_orderBy=displayName&_order=ASC&displayName=!Phone+Book+2",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/phone-books/100",
    "links": [],
    "data": [{
      "name": "phonebookEntryId",
      "value": 100
    }, {
      "name": "displayName",
      "value": "Phone Book"
    }, {
      "name": "displayNumber",
      "value": "+49 (66) 1234-555"
    }, {
      "name": "restricted",
      "value": true
    }]
  }]
}
GET a filtered list of Customer's Phonebooks using the specific attribute LIKE query
Filtering is done on fields :
  • displayName
Given I am authenticated as customer K0002
and there is a Phone Book with
  • id: 100
  • number: +49 (66) 1234-555
  • name: Phone Book
  • restricted: true
and there is another Phone Book with
  • id: 200
  • number: +49 (66) 1234-888
  • name: Phone Book 2
  • restricted: false
When I send /api/customers/K0002/phone-books?displayName=~*2
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/phone-books?_offset=0&_pagesize=16&_orderBy=displayName&_order=ASC&displayName=~*2",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/phone-books/200",
    "links": [],
    "data": [{
      "name": "phonebookEntryId",
      "value": 200
    }, {
      "name": "displayName",
      "value": "Phone Book 2"
    }, {
      "name": "displayNumber",
      "value": "+49 (66) 1234-888"
    }, {
      "name": "restricted",
      "value": false
    }]
  }]
}
GET a filtered list of Customer's Phonebooks using the specific INVERSE LIKE attribute query
Filtering is done on fields :
  • displayName
Given I am authenticated as customer K0002
and there is a Phone Book with
  • id: 100
  • number: +49 (66) 1234-555
  • name: Phone Book
  • restricted: true
and there is another Phone Book with
  • id: 200
  • number: +49 (66) 1234-888
  • name: Phone Book 2
  • restricted: false
When I send /api/customers/K0002/phone-books?displayName=!~*2
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/phone-books?_offset=0&_pagesize=16&_orderBy=displayName&_order=ASC&displayName=!~*2",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/phone-books/100",
    "links": [],
    "data": [{
      "name": "phonebookEntryId",
      "value": 100
    }, {
      "name": "displayName",
      "value": "Phone Book"
    }, {
      "name": "displayNumber",
      "value": "+49 (66) 1234-555"
    }, {
      "name": "restricted",
      "value": true
    }]
  }]
}
Missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/phone-books
Then I should receive HTTP/1.1 404 Not Found
{
  "detail": "Customer with identifier K0404 has not been found",
  "title": "Customer not found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Customer should not be able to GET another Customer's Phone Books
Given I am authenticated as Customer K0003
When I send /api/customers/K0002/phone-books
Then I should receive HTTP/1.1 403 Forbidden
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator should not be able to GET phone Books of a Customer that he cannot manage
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/phone-books
Then I should receive HTTP/1.1 403 Forbidden
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Operator should not be able to GET phone Books of a Customer that he cannot manage
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/phone-books
Then I should receive HTTP/1.1 403 Forbidden
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}