Api >

Service Portal REST API

POST assigns Phone Extension to Phone Book as visibility
Given I am authenticated as customer K0002
and there is a Phone Book with
  • id: 100
  • number: +49 (66) 1234-555
  • name: Phone Book
and there is a Phone Extension with
  • extension number 555
  • and display name Extension1
When I send /api/customers/K0002/phone-books/100/visibilities
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/555"
  }]
}
Then I should receive HTTP/1.1 201 Created
with http://localhost:9998/api/customers/K0002/phone-books/100/visibilities/555 and following body:
{
  "href": "/api/customers/K0002/phone-books/100/visibilities/555"
}

Given I am authenticated as customer K0002
When I send /api/customers/K0002/phone-books/100/visibilities/555
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/phone-books/100/visibilities/555",
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/555"
  }],
  "data": [{
    "name": "displayName",
    "value": "Extension1"
  }, {
    "name": "extensionNumber",
    "value": "555"
  }]
}
Cannot assigns Phone Extension of another Customer to Phone Book as visibility
Given I am authenticated as Admin
and there is a Phone Book with
  • id: 100
  • number: +49 (66) 1234-555
  • name: Phone Book
and there is a Phone Extension with
  • extension number 555
that belongs to Customer K0003
When I send /api/customers/K0002/phone-books/100/visibilities
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0003/targets/phone-extensions/555"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Phone Extension [555] does not belongs to Customer [K0002]",
    "path": "phoneExtension",
    "value": "/api/customers/K0003/targets/phone-extensions/555"
  }]
}
Cannot assigns Phone Extension twice to Phone Book as visibility
Given I am authenticated as customer K0002
and there is a Phone Book with
  • id: 100
  • number: +49 (66) 1234-555
  • name: Phone Book
And it is already set as visible for:
  • a Phone Extension with extension number 555 and display name Extension1
When I send /api/customers/K0002/phone-books/100/visibilities
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/555"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Phone Book [100] is already assigned as visible for Phone Extension [555]",
    "path": "phoneExtension",
    "value": "/api/customers/K0002/targets/phone-extensions/555"
  }]
}
Cannot assigns null Phone Extension to Phone Book as visibility
Given I am authenticated as customer K0002
and there is a Phone Book with
  • id: 100
  • number: +49 (66) 1234-555
  • name: Phone Book
When I send /api/customers/K0002/phone-books/100/visibilities
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": null
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Phone Extension cannot be null",
    "path": "phoneExtension",
    "value": null
  }]
}
Missing Phone Book
Given I am authenticated as customer K0002
And there is no Phone Book with ID 404 When I send /api/customers/K0002/phone-books/404/visibilities
with application/json; charset=UTF-8 and following body:
{
  "links": [{
    "rel": "phoneExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/555"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
{
  "detail": "Phone Book with ID 404 has not been found",
  "title": "Phone Book not found",
  "described_by": "http://api.nfon.net/probs/phone-book-not-found"
}