Api >

Service Portal REST API

Admin can see all Sites Data of given Account
Given I am authenticated as Admin
And there is an Account with SalesForceID a062000000HbAsd
And there is a Site with salesforceId a062000000HbZZZ for this account
with:
  • name set to Site Name
  • street set to Site Street
  • zip set to 00999
  • city set to Berlin
  • country set to DE
And there is another Account with External Identifier a062000000HbCVB
And there is a Site with salesforceId a062000000HbGTY for this account
When I send /api/accounts/a062000000HbAsd/sites
Then I should receive HTTP/1.1 200 OK
with following body
{
  "href": "/api/accounts/a062000000HbAsd/sites?_offset=0&_pagesize=16&_orderBy=name&_order=ASC",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/accounts/a062000000HbAsd/sites/a062000000HbZZZ",
    "links": [],
    "data": [{
      "name": "salesForceId",
      "value": "a062000000HbZZZ"
    }, {
      "name": "name",
      "value": "Site Name"
    }, {
      "name": "street",
      "value": "Site Street"
    }, {
      "name": "zip",
      "value": "00999"
    }, {
      "name": "city",
      "value": "Berlin"
    }, {
      "name": "country",
      "value": "DE"
    }, {
      "name": "isMobile",
      "value": false
    }]
  }]
}
Admin can see filtered Sites Data of given Account
Filtering is done on fields :
  • salesForceId
  • name
  • street
  • zip
  • city
  • country
Given I am authenticated as Admin
And there is an Account with SalesForceID a062000000HbAsd
And there is a Site with salesforceId a062000000HbZZZ for this account
with:
  • name set to Site Name
  • street set to Site Street
  • zip set to 00999
  • city set to Berlin
  • country set to DE
And there is another Site with salesforceId a062000000HbAAA for this account
with:
  • name set to another Site Name
  • street set to another Site Street
  • zip set to 001111
  • city set to Warsaw
  • country set to PL
When I send /api/accounts/a062000000HbAsd/sites?_q=999
Then I should receive HTTP/1.1 200 OK
with following body
{
  "href": "/api/accounts/a062000000HbAsd/sites?_offset=0&_pagesize=16&_q=999&_orderBy=name&_order=ASC",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/accounts/a062000000HbAsd/sites/a062000000HbZZZ",
    "links": [],
    "data": [{
      "name": "salesForceId",
      "value": "a062000000HbZZZ"
    }, {
      "name": "name",
      "value": "Site Name"
    }, {
      "name": "street",
      "value": "Site Street"
    }, {
      "name": "zip",
      "value": "00999"
    }, {
      "name": "city",
      "value": "Berlin"
    }, {
      "name": "country",
      "value": "DE"
    }, {
      "name": "isMobile",
      "value": false
    }]
  }]
}
Missing Account
Given I am authenticated as Admin
When I send /api/accounts/404/sites
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "title": "Account not found",
  "detail": "Account with Salesforce ID 404 not found",
  "described_by": "http://api.nfon.net/probs/account-not-found"
}
Customer cannot see Sites Data of Account
Given I am authenticated as customer K0002
And there is an Account with External Identifier a062000000HbAsd
When I send /api/accounts/a062000000HbAsd/sites
Then I should receive HTTP/1.1 403 Forbidden
with following body:
{
  "title": "Access forbidden",
  "detail": "Required role is missing",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator cannot access the list of Sites
Given I am authenticated as System Integrator S0002
When I send /api/accounts/1234/sites
Then I should receive HTTP/1.1 403 Forbidden With following body
{
  "title": "Access forbidden",
  "detail": "Required role is missing"
}
Operator cannot access the list of Sites
Given I am authenticated as Operator C0002
When I send /api/accounts/1234/sites
Then I should receive HTTP/1.1 403 Forbidden With following body
{
  "title": "Access forbidden",
  "detail": "Required role is missing"
}