Changes

stoney core: REST API

956 bytes added, 14:15, 7 September 2014
/* Mandatory headers */
'''Service Provider Person''' > '''Reseller Employee''' > '''Customer Employee''' > '''Reseller Person''' and '''Customer Person'''
The further down you go, the less rights you have a person has (this is currently independent from any existing roles, as these have not been finalized yet).
=== Service Provider Person (SPP) ===
==== Reseller Employee (RE) Rights ====
Sees the reseller they belong to, themselves, their own customers, people and their services. The following rights exist for a Reseller Employee (RE) and a Service Provider Person (SPP):
* RE.00: '''Create a customer''': Can create a customer.* RE.01: '''Retrieve all customerssome resellers''': Can retrieve all their customersthe reseller(s) they are an employee of.* RE.0201: '''Retrieve a customerreseller''': Can retrieve one of their customersthe reseller(s) they are an employee of.* RE.0302: '''Update a customerreseller:''' Can update one of their customersthe reseller(s) they are an employee of.* RE.0403: '''Partly Update a customerreseller''': Can partly update one of their customers.* RE.05: '''Delete customer''': Can delete one of their customers the reseller(if no people or services s) they are linked to the customer)an employee of.
* RE.04: '''Create a customer''': Can create a customer.* RE.05: '''Retrieve all customers''': Can retrieve all their customers.* RE.06: '''Retrieve a customer''': Can retrieve one of their customers.* RE.07: '''Update a customer:''' Can update one of their customers.* RE.08: '''Partly Update a customer''': Can partly update one of their customers.* RE.09: '''Delete customer''': Can delete one of their customers (if no people or services are linked to the customer). * RE.10: '''Create a person''': Can create a person (including making them an employee of their reseller(s) and of their customer(s)).* RE.0711: '''Retrieve all people''': Can retrieve all their people (of their reseller(s) and their customer(s)).* RE.0812: '''Retrieve a person''': Can retrieve one of their people (of their reseller(s) and their customer(s)).* RE.0913: '''Update a person:''' Can update a person (including making them an employee of their reseller(s) and of their customer(s)).* RE.1014: '''Partly Update a person''': Can partly update a person.* RE.1115: '''Delete person''': Can delete a person (if no services are linked to the person).
=== Customer Employee (CE) ===
| Bad Request
| The request was invalid. A descriptive error message will be sent within the response body.
 
|-
| 401
| Unauthorized
| The client has failed or not yet tried to authenticate.
 
|-
| 403
| Forbidden
| The client is not allowed to access the requested resource.
|-
|-
| 401409| UnauthorizedResource Conflict| The client has failed or not yet tried to authenticate. |-| 403| Forbidden| The client is not allowed to access State of the requested resourcedoesn't permit request.
|-
{
"error": {
"module": "core", "code": 123422, "message": "Validation failedThe request was well-formed but was unable to be followed due to semantic errors."
"details" : [
{
"module": "core", "code" : 54321006, "field" : "firstNameisCompany", "message" : "First name cannot is invalid, true or false will be longer than 35 charactersaccepted"
},
{
"module": "core",
"code" : 5123,
"field" : "password",
* the service must recognize <code>ETag</code>, <code>Last-Modified</code> and <code>Cache-Control: none</code> provided by the client and act accordingly.
* every answer to a GET request must include proper <code>Cache-Control</code> headers
* every PUT and PATCH request to update an object must include the <code>ETag</code> provided by the <code>GET</code> request to fetch the object initially. The API must respond with an <code>428 (Precondition Required)</code> if the ETag is missing.
''Implementation notes'':
For example, to request page number 3 with 40 items per page, a client would send the following GET request:
<pre>
GET /v1/userspeople?page=3&per_page=40
</pre>
=== Input validations ===
The service validates all input it receives from a client and returns a <code>422</code> (Unprocessable Entity) HTTP [[#Error_codes_and_responses|status code together with a descriptive error object]] in case of an input violation (but well-formed JSON). In case a client passes invalid JSON (a JSON parser is unable to parse the JSON string), the service returns a <code >400</code> (Bad Request) HTTP [[#Error_codes_and_responses|status code together with a descriptive error object]]containing the JSON parser error message.
= Notes =
SLB, editor, reviewer
3,368
edits