# API

CoviDok API accepts and sends JSON objects. The basic response structure is composed of three fields, as seen below;

{
  "version" : "1"
  "status": "OK/ERR"
  "body" : "Description/data"
}

The "response" field contains the actual content of the answer, while "status" indicates if the request was successful (value is either ERR or OK).
Error codes coming soon.

# Accepted calls

## Auth

### POST /api/Auth/login

Login authentication. Requires account login info, returns a session ID and the ientity of the logged in entity.

|Type|JSON|
|-----|-----|
|Request|{<br>  "email" : string,<br>  "password": string<br>}|
|Response|{<br>  "id" : SessionID,<br>  "firstName": x.Firstname,<br>  "lastName": x.Lastname,<br>  "role": "Doc/Ast/Par"<br>}|

### POST /api/Auth/register

Registration call. Returns with the type and ID of the created entity.

|Type|JSON|
|-----|-----|
|Request|{<br>  "firstName": string,<br>  "lastName": string,<br>  "email": string,<br>  "password": string,<br>  "role": "Doc/Ast/Par"<br>}|
|Response|{<br>  "role": "Doc/ast/Par",<br>  "ID": string}|

### POST /api/Auth/child

Adds a child to a parent. A parent can only add children to its own account (Parent is determined from session IDs).

|Type|JSON|
|-----|-----|
|Request|{<br> "id": sessionID,<br> "firstName": string,<br> "lastName": string,<br>  "birthDate": string,<br>  "socSecNum": string<br>}|
|Response|{<br> "ChildID": Child.Id<br>}|

## Doc

### GET /api/Doc

Lists all registered doctors in the system. Might be filterable in the future.

|Type|JSON|
|-----|-----|
|Request|{<br>  "id": sessionID<br>}|
|Response|{[[doc.Firstname, doc.Lastname, doc.Id], ...]}

### GET /api/Doc/{id}/assistants

Lists assistants for a specific doctor.

|Type|JSON|
|-----|-----|
|Request|{<br> "id": sessionID<br>}|
|Response|{[<br>  "firstName": Assistant.Firstname,<br>  "lastName" : Assistant.Lastname,<br>  "id" : Assistant.Id], ...<br>}|

### GET /api/Doc/{id}/children

Lists childern with onging or finished cases assigned to a doctor.

|Type|JSON|
|-----|-----|
|Request|{<br> "id": sessionID<br>}|
|Response|{[<br>  "firstName": Child.Firstname,<br>  "lastName" : Child.Lastname,<br>  "id" : Child.Id], ...<br>}|


## Case

### POST /api/Case/{id}/certreq

Posts a request for health certification. Must be related to a closed Task (represented by TaskID).

|Type|JSON|
|-----|-----|
|Request|{<br>  "id": SessionID,<br>}|
|Response|{<br>  "certID": string<br>}|

### GET /api/Case/{id}/certreq

Check status of health certification. Must be related to a closed Task (represented by TaskID).

|Type|JSON|
|-----|-----|
|Request|{<br>  "id": SessionID,<br>}|