Contacts Service APIs

Imagine your Dashboard (UI) needs to communicate with an external Contacts Service to be able to create contacts, update contacts, retrieve contact details to visualize in your Dashboard, and delete contacts. Here is a list of possible API calls that are exposed by the Contacts Service system which our Dashboard will need to call to be able to perform the aforementioned actions.
Contacts
POST /contacts/
PUT /contacts/{id}
GET /contacts/{id}
DELETE /contacts/{id}
Create Contact API
POST /contacts/

Create a new contact record in the Contacts Service system. Note that this is a POST API call which is typically used for when you want to create a new record in the database.

Request headers

api_key
string required

The publishable api key for application identification

Example:
1bda235f-1454-ef42-c457-1e988e346db4
Authorization
string required

Authorization Token

Example:
8649cb12-9093-5765-2720-107f5210cc8e

Request body

Object
name
string

The contact name

Example:
Sozos
surname
string

The contact surname

Example:
Karageorgiou
age
number

The contact age

Example:
39
phone
Array

The contact’s phone(s)

Object
type
string

The phone type

Enumeration:
LANDLINE
MOBILE
number
string

The phone number

Example:
96303540
country_code
string

The country code

Example:
CYP
address
Object

The contact’s address

address_line_1
string

The contact’s street address line 1

Example:
eBOs Tower, Office 101
address_line_2
string

The contact’s street address line 2

Example:
Arch. Makariou III and Mesaorias 1
post_code
string

The address post code

Example:
2322
area_town_city
string

The address area, town or city

Example:
Lakatamia
district
string

The address district

Example:
Nicosia
country
string

The address country

Example:
CYP

Responses

200 OK

The request has succeeded

Body
Object
id
string uuid

Contact unique identifier

Example:
771aa519-20de-1c1d-871c-bb7771e37dc5
Example 1
POST /contacts/ HTTP/1.1 

Content-Type: application/json

{
    "name": "Sozos",
    "surname": "Karageorgiou",
    "age": 39,
    "phone": [
        {
            "type": "MOBILE",
            "number": "96303540",
            "country_code": "CYP"
        }
    ],
    "address": {
        "address_line_1": "eBOs Tower, Office 101",
        "address_line_2": "Arch. Makariou III and Mesaorias 1",
        "post_code": "2322",
        "area_town_city": "Lakatamia",
        "district": "Nicosia",
        "country": "CYP"
    }
}

HTTP/1.1 200 OK 

Content-Type: application/json

{
    "id": "771aa519-20de-1c1d-871c-bb7771e37dc5"
}
Update a Contact API
PUT /contacts/{id}

Update a contact record in the Contacts Service system. Note that this is a PUT API call which is typically used for when you want to update an existing record in the database. In order for the Contacts Service system to identify which contact it must update this API call requires the contact’s id as a URL parameter (/contacts/{id}).

Path variables

id
string uuid required

The unique identifier of the contact

Example:
1d875242-310a-a1f4-9371-259e14d8801e

Request headers

api_key
string required

The publishable api key for application identification

Example:
f46cb605-ea98-9376-8f90-4dcefe5e5741
Authorization
string required

Authorization Token

Example:
c44cb38f-a114-42e3-157e-783150e7b95d

Request body

Object
name
string

The contact name

Example:
Sozos
surname
string

The contact surname

Example:
Karageorgiou
age
number

The contact age

Example:
39
phone
Array

The contact’s phone(s)

Object
type
string

The phone type

Enumeration:
LANDLINE
MOBILE
number
string

The phone number

Example:
96303540
country_code
string

The country code

Example:
CYP
address
Object

The contact’s address

address_line_1
string

The contact’s street address line 1

Example:
eBOs Tower, Office 101
address_line_2
string

The contact’s street address line 2

Example:
Arch. Makariou III and Mesaorias 1
post_code
string

The address post code

Example:
2322
area_town_city
string

The address area, town or city

Example:
Lakatamia
district
string

The address district

Example:
Nicosia
country
string

The address country

Example:
CYP

Responses

200 OK

The request has succeeded

Body
Object
id
string

Contact unique identifier

Example:
1d875242-310a-a1f4-9371-259e14d8801e
Example 1
PUT /contacts/1d875242-310a-a1f4-9371-259e14d8801e HTTP/1.1 

Content-Type: application/json

{
    "name": "Sozos",
    "surname": "Karageorgiou",
    "age": 39,
    "phone": [
        {
            "type": "LANDLINE",
            "number": "96303540",
            "country_code": "CYP"
        }
    ],
    "address": {
        "address_line_1": "eBOs Tower, Office 101",
        "address_line_2": "Arch. Makariou III and Mesaorias 1",
        "post_code": "2322",
        "area_town_city": "Lakatamia",
        "district": "Nicosia",
        "country": "CYP"
    }
}

HTTP/1.1 200 OK 

Content-Type: application/json

{
    "id": "1d875242-310a-a1f4-9371-259e14d8801e"
}
List (retrieve) all Contacts API
GET /contacts/

Retreive a list of all contacts in the Contacts Service system. Note that this is a GET API call which is typically used for when you want to get data from the database. This API call has a list of parameters that the caller can configure in order to filter the contacts that will be retreived from the Contacts Service system.

Request parameters

search_value
string optional

Text search on name and surname

age
number optional

Filter based on contact age

Example:
39
country
string optional

Filter based on contact address country

Example:
CYP
sort
string optional

Defines on which attribute the results should be sorted

Allow empty value: true
Example:
CREATED_DATE, UPDATED_DATE, NAME
order
string optional

Defines how the results will be ordered

Allow empty value: true
Enumeration:
ASC
DESC
Default:
DESC
page
string optional

The page number that should be retrieved

Default:
1
Example:
20
size
string optional

The size (total records) of each page

Default:
10
Example:
20

Request headers

api_key
string required

The publishable api key for application identification

Example:
1bda235f-1454-ef42-c457-1e988e346db4
Authorization
string required

Authorization Token

Example:
8649cb12-9093-5765-2720-107f5210cc8e

Responses

200 OK

The request has succeeded

Body
Array
Object
id
string uuid

The unique identifier of the contact

Example:
4b315ac8-0d54-2f94-e9bb-8741ebae982a
name
string

The contact name

Example:
Sozos
surname
string

The contact surname

Example:
Karageorgiou
age
number

The contact age

Example:
42
phone
Array

The contact’s phone(s)

Object
type
string

The phone type

Enumeration:
LANDLINE
MOBILE
number
string

The phone number

Example:
96303540
country_code
string

The country code

Example:
CYP
address
Object

The contact’s address

address_line_1
string

The contact’s street address line 1

Example:
eBOs Tower, Office 101
address_line_2
string

The contact’s street address line 2

Example:
Arch. Makariou III and Mesaorias 1
post_code
string

The address post code

Example:
2322
area_town_city
string

The address area, town or city

Example:
Lakatamia
district
string

The address district

Example:
Nicosia
country
string

The address country

Example:
CYP
Example 1
GET /contacts/ HTTP/1.1 

api_key: 1bda235f-1454-ef42-c457-1e988e346db4
Authorization: 8649cb12-9093-5765-2720-107f5210cc8e

HTTP/1.1 200 OK 

Content-Type: application/json

[
    {
        "id": "4b315ac8-0d54-2f94-e9bb-8741ebae982a",
        "name": "Sozos",
        "surname": "Karageorgiou",
        "age": 42,
        "phone": [
            {
                "type": "MOBILE",
                "number": "96303540",
                "country_code": "CYP"
            },
            {
                "type": "LANDLINE",
                "number": "22303540",
                "country_code": "CYP"
            }
        ],
        "address": {
            "address_line_1": "eBOs Tower, Office 101",
            "address_line_2": "Arch. Makariou III and Mesaorias 1",
            "post_code": "2322",
            "area_town_city": "Lakatamia",
            "district": "Nicosia",
            "country": "CYP"
        }
    },
    {
        "id": "750b2f62-d7a5-4cc2-9fe5-59ffb191d343",
        "name": "Jane",
        "surname": "smith",
        "age": 40,
        "phone": [
            {
                "type": "MOBILE",
                "number": "96123453",
                "country_code": "CYP"
            },
            {
                "type": "LANDLINE",
                "number": "22983647",
                "country_code": "CYP"
            }
        ],
        "address": {
            "address_line_1": "125 Spyros Kyprianou Ave",
            "address_line_2": "",
            "post_code": "2543",
            "area_town_city": "Lykavitos",
            "district": "Nicosia",
            "country": "CYP"
        }
    }
]
Get Contact details API
GET /contacts/{id}

Get information of a contact from the Contacts Service system. Note that this is a GET API call which is typically used for when you want to update an existing record in the database. In order for the Contacts Service system to identify which contact it must retrieve this API call requires the contact’s id as a URL parameter (/contacts/{id}).

Path variables

id
string uuid required

The unique identifier of the contact

Example:
4b315ac8-0d54-2f94-e9bb-8741ebae982a

Request headers

api_key
string required

The publishable api key for application identification

Example:
1bda235f-1454-ef42-c457-1e988e346db4
Authorization
string required

Authorization Token

Example:
8649cb12-9093-5765-2720-107f5210cc8e

Responses

200 OK

The request has succeeded

Body
Object
id
string

The unique identifier of the contact

Example:
4b315ac8-0d54-2f94-e9bb-8741ebae982a
name
string

The contact name

Example:
Sozos
surname
string

The contact surname

Example:
Karageorgiou
age
string

The contact age

Example:
39
phone
Array

The contact’s phone(s)

Object
type
string

The phone type

Enumeration:
LANDLINE
MOBILE
number
string

The phone number

Example:
96303540
country_code
string

The country code

Example:
CYP
address
Object

The contact’s address

address_line_1
string

The contact’s street address line 1

Example:
eBOs Tower, Office 101
address_line_2
string

The contact’s street address line 2

Example:
Arch. Makariou III and Mesaorias 1
post_code
string

The address post code

Example:
2322
area_town_city
string

The address area, town or city

Example:
Lakatamia
district
string

The address district

Example:
Nicosia
country
string

The address country

Example:
CYP
Delete a Contact API
DELETE /contacts/{id}

Delete a contact from the Contacts Service system. Note that this is a DELETE API call which is typically used for when you want to delete an existing record in the database. In order for the Contacts Service system to identify which contact it must delete this API call requires the contact’s id as a URL parameter (/contacts/{id}).

Path variables

id
string uuid required

The unique identifier of the contact

Example:
4b315ac8-0d54-2f94-e9bb-8741ebae982a

Request headers

api_key
string required

The publishable api key for application identification

Example:
1bda235f-1454-ef42-c457-1e988e346db4
Authorization
string required

Authorization Token

Example:
8649cb12-9093-5765-2720-107f5210cc8e

Responses

200 OK

The request has succeeded

Example 1
DELETE /contacts/4b315ac8-0d54-2f94-e9bb-8741ebae982a HTTP/1.1 

api_key: 1bda235f-1454-ef42-c457-1e988e346db4
Authorization: 8649cb12-9093-5765-2720-107f5210cc8e

HTTP/1.1 200 OK 
Users
POST /users/authenticate
POST /users/invite
GET /AASDA
User Authenticate
POST /users/authenticate

Authenticate a user and provide a token for subsequent API access

Request headers

api-key
string required

The publishable api key for application identification

Example:
ab5f8b2e-092f-4848-8f46-31df1c014060

Request body

Object
username
string

The user’s username

Example:
johndoe@ebos.com.cy
password
string

The user’s password

Example:
password1234

Responses

200 OK

The request has succeeded

Body
Object
access_token
string

The token that can be used in subsequent API calls

Example:
eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhMjc4ZDNlNS05YjhlLTQzNmUtOTIzMC03MGYzZTJkZjFjYTUiLCJleHAiOjE1Njg1NTQxMjJ9.LemqPPThkqfakkKS6CdkNvV1Lnc88CWirEpHOPnWjJPQz02zgkKSwfbvrEsl3OmR2LUhDILsOXf4x-GPFmNJCg
refresh_token
string

Used when access token gets expired in order to refresh

user
Object

Details about the authorised user

id
string

The user’s unique identifier

Example:
2f2f9afe-4399-59b7-cbb8-da18c2255064
name
string

The user’s name

Example:
Sozos
surname
string

The user’s surname

Example:
Karageorgiou
role
string

The user’s role

Enumeration:
ADMIN
EDITOR
VIEWER
Example 1
POST /users/authenticate HTTP/1.1 

api-key: ab5f8b2e-092f-4848-8f46-31df1c014060
Content-Type: application/json

{
    "username": "johndoe@ebos.com.cy",
    "password": "password1234"
}

HTTP/1.1 200 OK 

Content-Type: application/json

{
    "access_token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhMjc4ZDNlNS05YjhlLTQzNmUtOTIzMC03MGYzZTJkZjFjYTUiLCJleHAiOjE1Njg1NTQxMjJ9.LemqPPThkqfakkKS6CdkNvV1Lnc88CWirEpHOPnWjJPQz02zgkKSwfbvrEsl3OmR2LUhDILsOXf4x-GPFmNJCg",
    "refresh_token": "",
    "user": {
        "id": "2f2f9afe-4399-59b7-cbb8-da18c2255064",
        "name": "Sozos",
        "surname": "Karageorgiou",
        "role": "EDITOR"
    }
}
Invite New User
POST /users/invite

Invite a new user with a specific role

Request headers

authorization
string required

Authorization Token

Example:
eyJraWQiOiIvcHJpdmF0ZUtleS5wZW0iLCJ0eXAiOiJKV

Request body

Object
name
string

The user’s name

Example:
Jane
surname
string

The user’s surname

Example:
Doe
role
string

The user’s role

Enumeration:
ADMIN
EDITOR
VIEWER
username
string

The user’s username

Example:
jane.doe@ebos.com.cy

Responses

200 OK
Body
Object
id
string

The user’s unique identifier

Example:
CAD1E31269B76D7A65ACCE45B2E68DFD
Example 1
POST /users/invite HTTP/1.1 

authorization: eyJraWQiOiIvcHJpdmF0ZUtleS5wZW0iLCJ0eXAiOiJKV
Content-Type: application/json

{
    "name": "Jane",
    "surname": "Doe",
    "role": "VIEWER",
    "username": "jane.doe@ebos.com.cy"
}

HTTP/1.1 200 OK 

Content-Type: application/json

{
    "id": "CAD1E31269B76D7A65ACCE45B2E68DFD"
}
ssdas
GET /AASDA
New Service Requirements
GET /service_requirement

Request body

Object
device_type
string
Enumeration:
SENSOR
DRONE
PD
CAMERA
OTHER
Example:
SENSOR
number_of_devices
integer
Example:
5
Sensors
Object
type_sensor_readings
string
Enumeration:
SIMPLE
COMPLEX
order_of_magnitude
string
Enumeration:
ONCE_PER_SECOND
ONCE_PER_MINUTE
ONCE_PER_HOUR
ONCE_PER_DAY
processed_with_delay
string
drones
Object