Api >

Service Portal REST API

GET returns all Customer's Announcements
Given I am authenticated as customer K0002
and there is an Announcement
  • with Id 15
  • and name Welcome
  • and type MUSIC_ON_HOLD
  • and duration 10
and there is another Announcement
  • with Id 24
  • and name Farewell
  • and type MUSIC_ON_HOLD_SKILL
  • and duration 22
When I send /api/customers/K0002/announcements
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/announcements?_offset=0&_pagesize=16",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/announcements/15",
    "links": [],
    "data": [{
      "name": "announcementId",
      "value": 15
    }, {
      "name": "name",
      "value": "Welcome"
    }, {
      "name": "duration",
      "value": 10
    }, {
      "name": "type",
      "value": "MUSIC_ON_HOLD"
    }]
  }, {
    "href": "/api/customers/K0002/announcements/24",
    "links": [],
    "data": [{
      "name": "announcementId",
      "value": 24
    }, {
      "name": "name",
      "value": "Farewell"
    }, {
      "name": "duration",
      "value": 22
    }, {
      "name": "type",
      "value": "MUSIC_ON_HOLD_SKILL"
    }]
  }]
}
GET returns filtered Customer's Announcements
Given I am authenticated as customer K0002
and there is an Announcement
  • with Id 15
  • and name Welcome
  • and type MUSIC_ON_HOLD
  • and duration 10
and there is another Announcement
  • with Id 24
  • and name Farewell
  • and type MUSIC_ON_HOLD_SKILL
  • and duration 22
When I send /api/customers/K0002/announcements?_q=10
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/announcements?_offset=0&_pagesize=16&_q=10",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/announcements/15",
    "links": [],
    "data": [{
      "name": "announcementId",
      "value": 15
    }, {
      "name": "name",
      "value": "Welcome"
    }, {
      "name": "duration",
      "value": 10
    }, {
      "name": "type",
      "value": "MUSIC_ON_HOLD"
    }]
  }]
}
GET returns filtered Customer's Announcements by type
Given I am authenticated as customer K0002
and there is an Announcement
  • with Id 15
  • and name Welcome
  • and type MUSIC_ON_HOLD
  • and duration 10
and there is another Announcement
  • with Id 24
  • and name Farewell
  • and type MUSIC_ON_HOLD_SKILL
  • and duration 22
When I send /api/customers/K0002/announcements?_type=MUSIC_ON_HOLD
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/announcements?_offset=0&_pagesize=16",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/announcements/15",
    "links": [],
    "data": [{
      "name": "announcementId",
      "value": 15
    }, {
      "name": "name",
      "value": "Welcome"
    }, {
      "name": "duration",
      "value": 10
    }, {
      "name": "type",
      "value": "MUSIC_ON_HOLD"
    }]
  }]
}
GET fail to return filtered Customer's Announcements when type is unknown
Given I am authenticated as customer K0002
and there is an Announcement
  • with Id 15
  • and name Welcome
  • and type MUSIC_ON_HOLD
  • and duration 10
and there is another Announcement
  • with Id 24
  • and name Farewell
  • and type MUSIC_ON_HOLD_SKILL
  • and duration 22
When I send /api/customers/K0002/announcements?_type=SOMETHING
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "detail": "Could not create or update resource due to constraint violations",
  "title": "Validation error",
  "errors": [{
    "message": "Value is invalid. must be one of: MUSIC_ON_HOLD,MUSIC_ON_HOLD_QUEUE,MUSIC_ON_HOLD_SKILL,GENERAL_ANNOUNCEMENT",
    "path": "type",
    "value": "SOMETHING"
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Customer cannot get Announcement's list of another Customer
Given I am authenticated as Customer K0002
When I send /api/customers/K0003/announcements
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"
}
System Integrator cannot get Announcement's list of Customer, that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/announcements
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 get Announcement's list of Customer, that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/announcements
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"
}