~aleteoryx/muditaos

6da84949882ecc36b2cc3ec6fcf115321438c99e — Lukasz Mastalerz 3 years ago 49e6eca
[CP-1713] Publish OS API as MVP to our community

Publishing Protocol Description section to our community.
Publishing two endpoints: Device Info Endpoint and Contacts Endpoint.
A doc/os_api/endpoints/pure/contacts_endpoint.md => doc/os_api/endpoints/pure/contacts_endpoint.md +265 -0
@@ 0,0 1,265 @@
Contacts endpoint (7)
=============================
* [Parameters explanation](#parameters-explanation)
* [Pagination](#pagination)
* [Usage examples](#usage-examples)
  * [Get contacts count](#get-contacts-count)
  * [Get contacts using offset and limit](#get-contacts-using-offset-and-limit)
  * [Get a contact by ID](#get-a-contact-by-id)
  * [Add a new contact](#add-a-new-contact)
  * [Update a contact](#update-a-contact)
  * [Delete a contact](#delete-a-contact)


## Parameters explanation
[Common parameters explanation](../../protocol_description/common_parameters_explanation.md)

## Pagination 
[Pagination](../../protocol_description/pagination.md)

## Usage examples
### Get contacts count
**Note: For development/testing purposes only.**
**Request Payload Structure**
```
{
   "endpoint":7,
   "method":1,
   "uuid":1,
   "body":{
      "count":true
   }
}
```
**Response Payload Structure**
```
{
   "body":{
      "count":76
   },
   "endpoint":7,
   "status":200,
   "uuid":1
}
```

### Get contacts using offset and limit
See: [Pagination](../../protocol_description/pagination.md)
**Request Payload Structure**
```
{
   "endpoint":7,
   "method":1,
   "uuid":123,
   "body":{
      "offset":0,
      "limit":2
   }
}
```
**Response Payload Structure**
```
{
   "body":{
      "entries":[
         {
            "address":"Czeczota 6, 02-600 Warsaw, Poland",
            "altName":"Abraham",
            "email":"Abraham@example.com",
            "blocked":false,
            "favourite":true,
            "ice":true,
            "id":1,
            "numbers":[
               "123456789"
            ],
            "speedDial":"",
            "priName":"Olivia",
            "note":""
         },
         {
            "address":"Czeczota 6, 02-600 Warsaw, Poland",
            "altName":"Alsop",
            "email":"Alsop@example.com",
            "blocked":false,
            "favourite":true,
            "ice":true,
            "id":3,
            "numbers":[
               "123456789"
            ],
            "speedDial":"7",
            "priName":"Charles",
            "note":""
         }
      ],
      "totalCount":76
   },
   "endpoint":7,
   "status":200,
   "uuid":123
}
```

Parameters:

- *address*  - contact address
- *altName* - secondary name of contact
- *email* - contact’s email address
- *blocked* - true if contact is blocked
- *favourite* - true if contact is on favorites list
- *ice* - true if contact is on in case of emergency list
- *id* - contact id
- *numbers* - list of contact numbers
- *speedDial* - speed dial number
- *priName* - primary name of contact
- *note* - note attached to contact

### Get a contact by ID
**Note: For development/testing purposes only.**
**Request Payload Structure**
```
{
   "endpoint":7,
   "method":1,
   "uuid":1,
   "body":{
      "id":5
   }
}
```
**Response Payload Structure**
```
{
   "body":{
      "address":"Czeczota 6, 02-600 Warsaw, Poland",
      "altName":"Arnold",
      "email": "Arnold@example.com",
      "blocked":false,
      "favourite":false,
      "ice":true,
      "id":5,
      "numbers":[
         "123456789"
      ],
      "speedDial":"6",
      "priName":"Donna",
      "note":"likes oranges"
   },
   "endpoint":7,
   "status":200,
   "uuid":1
}
```

### Add a new contact
**Request Payload Structure**
```
{
   "endpoint":7,
   "method":2,
   "uuid":123,
   "body":{
      "address":"Czeczota 6, 02-600 Warsaw, Poland",
      "altName":"Turk",
      "email":"Turk@example.com",
      "blocked":false,
      "favourite":true,
      "ice":false,
      "numbers":[
         "123456789"
      ],
      "speedDial":"",
      "priName":"Tolek",
      "note":"has a cat"
   }
}
```
**Response Payload Structure when contact is successfully added**
```
{
{
   "body":{
      "id":77
   },
   "endpoint":7,
   "status":200,
   "uuid":123
}
```

Parameters:
- *id*  - id of newly created contact

**Response Payload Structure when contact is matched as a duplicate**
```
{
   "body":{
      "id":76
   },
   "endpoint":7,
   "status":409,
   "uuid":123
}
```
Parameters:
- *id*  - id of duplicated contact

### Update a contact
**Request Payload Structure**
```
{
   "endpoint":7,
   "method":3,
   "uuid":123,
   "body":{
      "id":77,
      "address":"Czeczota 6, 02-600 Warsaw, Poland",
      "altName":"Turk",
      "email":"Turk@example.com",
      "blocked":false,
      "favourite":true,
      "ice":false,
      "numbers":[
         "123456789"
      ],
      "speedDial":"",
      "priName":"Tolek",
      "note":"has a cat"
   }
}
```
**Response Payload Structure when contact is successfully updated**
```
{
   "endpoint":7,
   "status":204,
   "uuid":123
}
```
Warning: 
In the current implementation, there is no duplicate detection while updating contact.
Example:
We have contact A with number 123 and contact B with number 456.
Contact A is updated with a new number - 456. Number 456 is silently unattached from contact B and assigned to contact A. Finally, we have contact A with number 456 and contact B with no number.

### Delete a contact
**Request Payload Structure**
```
{
   "endpoint":7,
   "method":4,
   "uuid":1,
   "body":{
      "id":77
   }
}
```
**Response Payload Structure**
```
{
   "endpoint":7,
   "status":204,
   "uuid":1
}
```
\ No newline at end of file

A doc/os_api/endpoints/pure/device_info_endpoint.md => doc/os_api/endpoints/pure/device_info_endpoint.md +220 -0
@@ 0,0 1,220 @@
Device Info endpoint (1)
=============================
* [Parameters explanation](#parameters-explanation)
* [Usage examples](#usage-examples)
  * [Get Device Information](#get-device-information)
  * [Get a List of logs and crash dumps](#get-a-list-of-logs-and-crash-dumps)


## Parameters explanation
[Common parameters explanation](../../protocol_description/common_parameters_explanation.md)

## Usage examples
### Get Device Information
**Request Payload Structure**
```
#000000036
{
   "endpoint":1,
   "method":1,
   "uuid":123
}
```

 Parameters:

 - *endpoint* - endpoint type (it’s set to 1, which means **“deviceInfo”** type) - see code snippets below
 - *method* - method type (it’s set to 1, which means **“get”** method) - see code snippets below
 - *uuid* - unique payload id

 “*body*” parameter is not needed in this case.

```
enum class EndpointType
{
    invalid = 0,
    deviceInfo,
    update, 
    filesystemUpload,
    backup,
    restore,
    factory,
    contacts,
    messages,
    calllog,
    developerMode,
};
```
```
enum class Method
{
    get = 1,
    post, 
    put,
    del
};
```

**Response Payload Structure**
```
{
   "body":{
      "accessTechnology":"7",
      "batteryLevel":"68",
      "batteryState":"2",
      "caseColour":"gray",
      "currentRTCTime":"1626085629",
      "deviceToken":"<32-character string"
      "deviceSpaceTotal":"14945",
      "systemReservedSpace":"2042",
      "usedUserSpace":"440",
      "gitBranch":"master",
      "gitRevision":"58e3688f6",
      "gitTag":"release-0.73.1-rc1-11-g58e3688f6",
      "networkOperatorName":"Play",
      "networkStatus":"1",
      "selectedSim":"0",
      "signalStrength":"2",
      "trayState":"1",
      "version": "0.73.1",
      "serialNumber": "12345678901234",
      "backupLocation": "path/to/directory",
      "syncPackageLocationLocation": "path/to/directory"
   },
   "endpoint":1,
   "status":200,
   "uuid":123
}
```

 Parameters:
 
 - *body*  - actual response from endpoint in response message
 - *accessTechnology* - network access technology - see code snippets below
 - *batteryLevel* - battery level (in percentage)
 - *batteryState* - battery state - see code snippets below
 - *caseColour* - colour of the Pure’s case (gray or black)
 - *currentRTCTime* - current timestamp from RTC (in seconds)
 - *deviceToken* - unique device token
 - *deviceSpaceTotal* - total storage space on the device (in Mebibytes)
 - *systemReservedSpace* - storage space on the device reserved for the OS (in Mebibytes)
 - *usedUserSpace* - storage space on the device used for user files on the user partition (in Mebibytes)
 - *gitBranch* - git branch from which the system was built 
 - *gitRevision* - git commit sha from which the system was built
 - *gitTag* - git tag from which the system was built
 - *networkOperatorName* - current network operator name
 - *networkStatus* - current status of network - see code snippets below
 - *selectedSim* - selected SIM status - see code snippets below
 - *signalStrength* - number of signal strength indicator bars - from 0 to 4
 - *trayState* - state of SIM tray - see code snippets below
 - *endpoint* - endpoint type (it’s set to 1, which means “deviceInfo” type)
 - *status* - http like status code - see code snippets below
 - *uuid* - unique payload id, same as in request message
 - *version* - os version string
 - *serialNumber* - device serial number (14 digits)
 - *"backupLocation"* - path to the location of backup files on device file-system
 - *"syncPackageLocation"* - path to the location of sync package on device filesystem

```
struct Network
{
    enum class Status
    {
        NotRegistered,
        RegisteredHomeNetwork,
        Searching,
        RegistrationDenied,
        Unknown,
        RegisteredRoaming
    }

    enum class AccessTechnology
    {
        Gsm   = 0x00,
        Utran = 0x02,
        GsmWEgprs,
        UtranWHsdpa,
        UtranWHsupa,
        UtranWHsdpaAndWHsupa,
        EUtran, // 7
        Unknown = 0xFF
    }
};
```
```
struct Battery
{
    enum class State
    {
        Discharging,
        Charging,
        PluggedNotCharging,
    }
};
```
```
enum class SIM
{
    SIM1 = 0,
    SIM2,
    SIM_FAIL,
    SIM_UNKNOWN,
    NONE,
}
```
```
enum class Tray
{
    OUT = 0,
    IN
}
```


### Get a List of diagnostics files
**Request Payload Structure**
```
{
   "endpoint":1,
   "method":1,
   "uuid":123,
   "body": { "fileList":0 }
}
```

 Parameters:
 - *endpoint* - endpoint type (it’s set to 1, which means “**deviceInfo**” type) - see code snippets below
 - *method* - method type (it’s set to 1, which means “**get**” method) - see code snippets below
 - *uuid* - unique payload id
 - *fileList* - indicates the type of diagnostic data to be listed - see below

```
enum class DiagnosticsFileList
{
    LOGS = 0,
    CRASH_DUMPS,
    TDB
}
```

**Response Payload Structure**  
List of available log files
```
{
   "endpoint":1,
   "status":200,
   "uuid":123,
   "body": {"files":[ "/sys/user/MuditaOS.log",
                      "/sys/user/MuditaOS.log.1",
                      "/sys/user/MuditaOS.log.2" ] }
}
```
Empty response, no log/crash dump files available on a device
```
#000000036
{
   "endpoint":1,
   "status":204,
   "uuid":123
}
```
\ No newline at end of file

A doc/os_api/protocol_description/common_parameters_explanation.md => doc/os_api/protocol_description/common_parameters_explanation.md +71 -0
@@ 0,0 1,71 @@
# Common parameters explanation

- *endpoint* - the target endpoint
```
    invalid = 0,
    deviceInfo = 1,
    update = 2, 
    filesystemUpload = 3,
    backup = 4,
    restore = 5,
    factory = 6,
    contacts = 7,
    messages = 8,
    calllog = 9,
    calendarEvents= 10,
    developerMode = 11,
    bluetooth = 12,
    usbSecurity = 13
```

- *method* - the request methods that indicate the desired action to be performed for a given resource.
  - Get - to retrieve resources only, and not to modify it in any way.
  - Post - to create a new resource into the collection of resources.
  - Put - to update an existing resource, and if the resource doesn’t exist, then don’t create it.
  - Del - to delete a resource.

```
    GET = 1,
    POST = 2,
    PUT = 3,
    DEL = 4
```

- *uuid* - unique payload id, request and the response to it should have the same uuid parameter.
The payload id is 32bits unsigned integer, that wraps around once it reaches its max value.
Both request and response should transport the payload id by a numeric type (in case of JSON format).

- *category* - Optional parameter. It accepts one of three values: *thread*, *message*, *template*.

- *status* - HTTP-like status code.
\* - Accepted response code is used to indicate that the request has been accepted for processing, but the processing is asynchronous. Thanks to that, a client doesn’t have to wait for the result of the processing.
** - SeeOther response code indicates that the resource has finished its work, but instead of sending a response body, it redirects the client to a resource.
*** - Forbidden response code indicates that the resource is not accessible due to phone lock - see Security endpoint (13) 
**** - Locked the response code indicates that the resource is unavailable due to not accepting the EULA - see Security endpoint (13)
```
    OK                  = 200,
    Accepted            = 202, *
    NoContent           = 204,
    SeeOther            = 303, **
    BadRequest          = 400,
    Forbidden           = 403, ***
    NotFound            = 404,
    NotAcceptable       = 406,
    UnprocessableEntity = 422,
    Locked              = 423, ****
    InternalServerError = 500,
    NotImplemented      = 501,
    InsufficientStorage = 507
```

- *SMSType* - Optional parameter. It accepts the following values:
```
    DRAFT   = 1,  // Defines unfinished message that should be loaded in editor for a given thread and may be later scheduled for sending.
    FAILED  = 2,  // Defines message that was queued for sending but this process for some reasons failed.
    INBOX   = 4,  // Defines incoming message.
    OUTBOX  = 8,  // Defines outgoing message.
    QUEUED  = 16, // Defines message that is scheduled for sending.
    INPUT   = 18, // Used only internally on MuditaOS side.
    UNKNOWN = 255 // Type used for initialization.
```
 
\ No newline at end of file

A doc/os_api/protocol_description/error_handling_strategy.md => doc/os_api/protocol_description/error_handling_strategy.md +104 -0
@@ 0,0 1,104 @@
# Error handling strategy
If any error occurs while processing the client’s requests, the server returns an error response in the following form:
```
{
  "endpoint": <endpoint id>,
  "uuid": <unique id>,
  "status": <status code>
}
```
Where:
- *endpoint id* is an identifier of a target endpoint
- *unique id* is a unique identifier for a pair of request-response.
- *status code* is a status code, based on HTTP error codes.

## Error status codes
For all status codes, see: [Common parameters explanation](common_parameters_explanation.md)

Statuses **4XX** and **5XX** are reserved for errors.
- **4xx** - client’s errors.
- **5xx** - internal server’s errors.

## Endpoint-local error codes
Some endpoints may introduce local error codes to indicate the endpoint-specific errors.

For example, the Update endpoint introduced Update errors that indicate the detailed problem that occurred during the update procedure.

Endpoint-local error codes are sent in the message body, and not in the message headers.

```
#000000250
{
"body": {
  "errorCode": 12
}, 
"endpoint": 2, 
"status": 500, 
"uuid": 123
}
```
Where *errorCode: 12* means *CantDeletePreviousOS*.

## Examples
- A message couldn’t be found on GET request
```
{
   "endpoint": 8,
   "method": 1,
   "uuid": 123,
   "body": {
      "category": "message",
      "messageID": 8
   }
}
```
```
{
  "endpoint": 8,
  "uuid": 123,
  "status": 404,
  "message": "The message does not exist." 
}
```
- Incorrect request JSON (request is ill-formed)
```
{
   "endpoint": 8,
   "method": 1,
   "uuid": 123,
   "body": {
      "category": "msg",
      "messageID": 8
   }
}
```
```
{
  "endpoint": 8,
  "uuid": 123,
  "status": 400,
  "message": "The request is ill-formed." 
}
```
- Server logical error

```
{
   "endpoint": 8,
   "method": 1,
   "uuid": 123,
   "body": {
      "category": "message",
      "messageID": 8
   }
}
```
```
{
  "endpoint": 8,
  "uuid": 123,
  "status": 500,
  "message": "Internal server error (#code)" 
}
```
**Note:** Additional internal server error code may be added to the message if needed.
\ No newline at end of file

A doc/os_api/protocol_description/methods.md => doc/os_api/protocol_description/methods.md +45 -0
@@ 0,0 1,45 @@
# Methods
Methods indicate the desired action to be performed for a given resource.
See: [Common parameters explanation](common_parameters_explanation.md)

## Get
- Used to retrieve resources, and not to modify it in any way.
- Do not change the state of a resource.

Response codes:
- If a resource is found, the response code is *200*.
- If a resource is not found, the response code is *404*.
- If an internal server error occurred, the response code is *500*.

## Post
- Used to create a new resource into the collection of resources.

Response codes:

- If a resource has been created, and response contains body field, the response code is *200*.
- If a resource has been created, but response contains no body field, the response code is *204*.
- If a request is incorrect, the response code is *400*
- If an internal server error occurred, the response code is *500*.

## Put
- Used to update an existing resource.
- If the resource doesn’t exist, the Put method doesn’t create it.

Response codes:

- If a resource has been modified, and response contains body field, the response code is *200*.
- If a resource has been modified, but response contains no body field, the response code is *204*.
- If a request is incorrect, the response code is *400*.
- If a resource doesn’t exist, the response code is *404*.
- If an internal server error occurred, the response code is *500*.

## Del
- Use to delete a resource.

Response codes:

- If a resource has been deleted, and response contains body field, the response code is 200.
- If a resource has been deleted, but response contains no body field, the response code is 204.
- If a request is incorrect, the response code is 400.
- If a resource doesn’t exist, the response code is 404.
- If an internal server error occurred, the response code is 500.
\ No newline at end of file

A doc/os_api/protocol_description/pagination.md => doc/os_api/protocol_description/pagination.md +151 -0
@@ 0,0 1,151 @@
# Pagination

## Abstract
Because of the low amount of RAM memory, the PurePhone is not able to transfer huge amount of data (messages, contacts, notes, etc.) in a single message. This is the reason why responses to the GET requests need to be paged and shared with the Mudita Center in chunks.

## Request
In order to GET data from the PurePhone in a paged form, Mudita Center should send the following request to an endpoint:
```
#000000069{
  "endpoint": 7,
  "method": 1,
  "uuid": 1103,
  "body": {
    "limit": 9,
    "offset": 0
  }
}
```

Where: 
- *"endpoint"*: 7 means Contacts Endpoint
- *"method"*: 1 means GET method
- *“body.offset”* : 0 and "body.limit”: 9 mean that the elements from 1st to 9th are requested 

**Note: collections are zero-indexed**
If the response doesn’t contain the body.offset value, the PurePhone is still going to respond in the paged form.
The following request:
```

#000000069{
  "endpoint": 7,
  "method": 1,
  "uuid": 1103,
  "body": {
    "limit": 9
  }
}
```
requests for the elements from 1st to 9th, and it may be considered identical to the previous one.

###Get all elements
Sending the following request:

```
#000000069{
  "endpoint": 7,
  "method": 1,
  "uuid": 1103
}
```
will request for all elements in the collection. The elements will also be returned in the paged form.

## Response
**Note:** Let’s assume the Contacts Endpoint is able to return only 3 elements per page at most (It’s configured on the PurePhone side).

### Success
The successful response to the request above looks like:
```
#000000540{
  "endpoint": 7,
  "status": 200,
  "uuid": "1103",
  "body": {
    "totalCount": 4,
    "nextPage": {
      "offset": 3,
      "limit": 1
    },
    "entries": [
      {
        "address": "6 Czeczota St.02600 Warsaw",
        "altName": "Kwasigroch",
        "blocked": false,
        "favourite": true,
        "id": 73,
        "numbers": [
          "500618547"
        ],
        "priName": "Roland"
      },
      {
        "address": "6 Czeczota St.02600 Warsaw",
        "altName": "Małolepszy",
        "blocked": false,
        "favourite": true,
        "id": 13,
        "numbers": [
          "500011043"
        ],
        "priName": "Alek"
      },
      {
        "address": "6 Czeczota St.02600 Warsaw",
        "altName": "Małolepszy",
        "blocked": false,
        "favourite": true,
        "id": 18,
        "numbers": [
          "500656267"
        ],
        "priName": "Mariola"
      }
    ]
  }
}
```

##### Next request
Once the response is received, Mudita Center knows the information about the next page (carried in the ”nextPage” object in JSON). Now, Mudita Center shall request the next page the following way:

```
#000000069{
  "endpoint": 7,
  "method": 1,
  "uuid": 1104,
  "body": {
    "limit": 1,
    "offset": 3
  }
}
```
and it will receive the following response for the last page:

```
#000000540{
  "endpoint": 7,
  "status": 200,
  "uuid": "1104",
  "body": {
    "totalCount": 4,
    "entries": [
      {
        "address": "6 Czeczota St.02600 Warsaw",
        "altName": "Kwasigroch",
        "blocked": false,
        "favourite": true,
        "id": 80,
        "numbers": [
          "500618547"
        ],
        "priName": "Roland"
      }
    ]
  }
}
```
**Note:** If the response points to the last page, it doesn’t carry the nextPage information.

### Failure
TBD


A doc/os_api/protocol_description/protocol_description.md => doc/os_api/protocol_description/protocol_description.md +217 -0
@@ 0,0 1,217 @@
# Protocol description
## Message structure
**[ message_type | payload_length | payload[0] | payload[1] | ... | payload[payload_length-1]**
```
uint8_t message_type;
uint8_t payload_length[9];
uint8_t payload[payload_length];
```

### Message types   
*Single printable ASCII character.*
```
endpoint = '#'
rawData = '$
```

### Payload length  
*Represented by 9 printable ASCII characters.*

### Payload structure  
*Simple json with some fields. Difference between request and response payload is "method" and "status" fields.*
```
requestPayloadJson:
{
     { "endpoint", endpointNumber },
     { "method", methodNumber},
     { "body", requestBodyJson },
     { "uuid", uuidNumber }
}

responsePayloadJson:
{
     { "endpoint", endpointNumber },
     { "status", statusCode},
     { "body", responseBodyJson },
     { "uuid", uuidNumber }
}

```

##### Endpoint 
*Each endpoint has its unique number.*
```
invalid             = 0
deviceInfo          = 1
contacts            = 7
```
<!--- Update later when documentation will be extended --->
##### Method
*HTTP - like methods. Each has different number. Only in request message.*
```
get     = 1
post    = 2
put     = 3
del     = 4
```

##### Status
*HTTP status codes. Only in response message.*
```
OK                  = 200
Accepted            = 202
NoContent           = 204
SeeOther            = 303
BadRequest          = 400
Forbidden           = 403
NotFound            = 404
NotAcceptable       = 406
InternalServerError = 500
NotImplemented      = 501
```

##### Body
*Actual response from endpoint in response message. In request message its optional and depends on used method.*

## API
### Example

##### Request
```
#000000053{"endpoint":"invalid", "method":"GET", "payload":{"test":"test"}}
```
##### Response
```
#000000413{"body":
{"accessTechnology": "7", "batteryLevel": "99", "batteryState": "1", 
"currentRTCTime": "1611586206", "fsFree": "13903", "fsFreePercent": "100", "fsTotal": "13913", 
"gitBranch": "master", "gitRevision": "34594b42a", "gitTag": "release-0.53.2-46-g34594b42a", 
"networkStatus": "1", "selectedSim": "4", "signalStrength": "4", "trayState": "1", 
"updateHistory": null},
"endpoint": 1, "status": 200, "uuid": 0}
```

### Contacts
##### get contacts count:
```
#000000059{"endpoint":7, "method":1, "uuid":1, "body":{"count":true}}
```
sample response:
```
#000000064{"body": {"count": 76}, "endpoint": 7, "status": 200, "uuid": 1}}}
```
##### get contact by id:
```
#000000053{"endpoint":7, "method":1, "uuid":1, "body":{"id":5}}
```
parameters:
- *id* - contact id

sample response:
```
#000000205{"body": 
{"address": "6 Czeczota St.02600 Warsaw", 
"altName": "Pacha", 
"blocked": false, 
"favourite": false, 
"id": 5, 
"numbers": ["123456789"], 
"priName": "Zofia"}, 
"endpoint": 7, "status": 200, "uuid": 1}
```
##### get contacts ( eg. 5 first contacts) :
```
#000000056{"endpoint":7, "method":1, "uuid":1, "body":{"count":5}}
```


parameters:
- *count* - amount of contacts to be fetched starting from position 0

sample response:
```
#000000846{"body": 
[
{"address": "6 Czeczota St.02600 Warsaw", "altName": "Arbuz", "blocked": false, "favourite": true, "id": 4, "numbers": ["123456789"], "priName": "Alek"},
{"address": "6 Czeczota St.02600 Warsaw", "altName": "Boligłowa", "blocked": false, "favourite": true, "id": 19, "numbers": ["123456789"], "priName": "Alek"},
{"address": "6 Czeczota St.02600 Warsaw", "altName": "Boligłowa", "blocked": false, "favourite": true, "id": 22, "numbers": ["123456789"], "priName": "Grażyna"},
{"address": "6 Czeczota St.02600 Warsaw", "altName": "Boligłowa", "blocked": false, "favourite": true, "id": 20, "numbers": ["123456789"], "priName": "Zofia"},
{"address": "6 Czeczota St.02600 Warsaw", "altName": "Bubel", "blocked": false, "favourite": true, "id": 44, "numbers": ["123456789"], "priName": "Brian"}
]
 , "endpoint": 7, "status": 200, "uuid": 1}
 ```

 ##### get contacts by setting count and offset
 ```
 #000000069{"endpoint":7, "method":1, "uuid":1, "body":{"count":3, "offset":20}}
 ```
 parameters:
- *count* - amount of contacts to be fetched   
- *offset* - offset on  the contact list

sample response:
```
#000000538{"body":
[
{"address": "6 Czeczota St.02600 Warsaw", "altName": "Kwasigroch", "blocked": false, "favourite": true, "id": 73, "numbers": ["123456789"], "priName": "Roland"}, 
{"address": "6 Czeczota St.02600 Warsaw", "altName": "Małolepszy", "blocked": false, "favourite": true, "id": 13, "numbers": ["123456789"], "priName": "Alek"}, 
{"address": "6 Czeczota St.02600 Warsaw", "altName": "Małolepszy", "blocked": false, "favourite": true, "id": 18, "numbers": ["123456789"], "priName": "Mariola"}
], 
"endpoint": 7, "status": 200, "uuid": 1}
```

##### add contact:  

```
#000000193{"endpoint":7, "method":3, "uuid":124, "body":
{"address": "6 Czeczota St.\n 02600 Warsaw", 
"altName": "Turk", 
"blocked": true, 
"favourite": true, 
"numbers": ["123456789"], 
"priName": "Tolek"}}
```

parameters:
- as seen on listing above

sample response:
```
#000000063{"body": {"id": 79}, "endpoint": 7, "status": 200, "uuid": 124}
```

##### update contact:

```
#000000202{"endpoint":7, "method":2, "uuid":123, "body": 
{"address": "6 Czeczota St.02600 Warsaw", 
"altName": "Cicero", 
"blocked": true, 
"favourite": true, 
"id": 25, 
"numbers": ["123456789"], 
"priName": "Wacek"}}
```
parameters:
- as seen on listing above

sample response:
```
#000000043{"endpoint": 7, "status": 204, "uuid": 123}
```
or bad one:
```
#000000043{"endpoint": 7, "status": 500, "uuid": 123}
```

##### remove contact:
```
#000000057{"endpoint":7, "method":4, "uuid":123, "body":{"id": 23}}
```
parameters:
- *id* - id of contact to be removed

sample response:
```
#000000043{"endpoint": 7, "status": 204, "uuid": 123}
```