Api >

Service Portal REST API

Create Account
Given I am authenticated as admin
When I send /api/accounts as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "salesForceId",
    "value": "a062000000HbAsd"
  }]
}
Then I should receive HTTP/1.1 201 Created with header http://localhost:9998/api/accounts/a062000000HbAsd
When I am authenticated as admin
When I send /api/accounts/a062000000HbAsd
Then I should receive HTTP/1.1 200 OK
Cannot create Account
Given I am authenticated as K0002
When I send /api/accounts as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "salesForceId",
    "value": "a062000000HbAsd"
  }]
}
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"
}
Can't create Account which already exists
Given I am authenticated as admin
and there is an account with salesforce ID S123456
When I send /api/accounts as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "salesForceId",
    "value": "S123456"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Account with id [S123456] already exists"
  }]
}
System Integrator cannot create Account
Given I am authenticated as System Integrator S0002
When I send /api/accounts as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "salesForceId",
    "value": "a062000000HbAsd"
  }]
}
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"
}
Operator cannot create Account
Given I am authenticated as Operator C0002
When I send /api/accounts as application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "salesForceId",
    "value": "a062000000HbAsd"
  }]
}
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"
}