The API¶
The server exposes a simple API to get data from the database. The methods can
be classified in two groups, based on the object they return. All API access is
over HTTPS and accessed from https://giuseppe-desolda.ddns.net:8080
. All
data is returned as JSON.
Users¶
APIs¶
-
GET
/api/users
¶ Get all the users.
Example request:
GET /api/users HTTP/1.1 HOST: giuseppe-desolda.ddns.net:8080
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [ { "_id": "5ea18ca785dffb5712068595", "age": "2", "internet": "4", "gender": "m" }, { "_id": "5ea1b63385dffb57120720c3", "age": "2", "internet": "4", "gender": "m" } ]
- Status Codes
200 OK – No error
-
GET
/api/users/
(int: skip)-
(int: limit)¶ Get the first limit users starting from skip (included).
Example request:
GET /api/users/3-2 HTTP/1.1 HOST: giuseppe-desolda.ddns.net:8080
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [ { "_id": "5eab3d3f348b1746eeb06a99", "age": "2", "gender": "m", "internet": "18" }, { "_id": "5eb014d0348b1746eeb76c18", "age": "2", "gender": "m", "internet": "18" } ]
- Parameters
skip – The number of users to skip
limit – The number of users to return
- Status Codes
200 OK – No error
-
GET
/api/user/
(str: id)¶ Get the user with id id.
Example request:
GET /api/user/5ebd67189976b12b146a2735 HTTP/1.1 HOST: giuseppe-desolda.ddns.net:8080
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "_id": "5ebd67189976b12b146a2735", "age": "2", "gender": "f", "internet": "7" }
- Parameters
id – The id of the user
- Status Codes
200 OK – No error
Interactions¶
Index¶
APIs¶
-
GET
/api/interactions
¶ Get all the interactions. Warning: due to the huge quantity of data it’s likely that the connection will timeout.
Example request:
GET /api/user/5ebd67189976b12b146a2735 HTTP/1.1 HOST: giuseppe-desolda.ddns.net:8080
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [ { "_id": "5ea1bc9a85dffb571207298e", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657878562, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} }, { "_id": "5ea1bc9a85dffb571207298f", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657878685, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} }, { "_id": "5ea1bc9a85dffb5712072990", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657878810, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} }, { "_id": "5ea1bc9a85dffb5712072991", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657878857, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} }, { "_id": "5ea1bc9a85dffb5712072992", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657878966, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} } ]
- Status Codes
200 OK – No error
-
GET
/api/interactions/
(int: skip)-
(int: limit)¶ Get the first limit interactions starting from the skip. Warning: due to the huge quantity of data it’s likely that the connection will timeout.
Example request:
GET /api/interactions/4-2 HTTP/1.1 HOST: giuseppe-desolda.ddns.net:8080
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [ { "_id": "5ea1bc9a85dffb5712072992", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657878966, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} }, { "_id": "5ea1bc9a85dffb5712072993", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657879058, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} } ]
- Parameters
skip – The number of interactions to skip
limit – The number of interactions to return
- Status Codes
200 OK – No error
-
GET
/api/interaction/
(str: id)¶ Get the interaction with id id.
Example request:
GET /api/interaction/5ea1bc9a85dffb5712072992 HTTP/1.1 HOST: giuseppe-desolda.ddns.net:8080
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "_id": "5ea1bc9a85dffb5712072992", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657878966, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} }
- Parameters
id – The id of the interaction
- Status Codes
200 OK – No error
-
GET
/api/user/
(str: id)/interactions
¶ Get all the interaction of the user with id id.
Example request:
GET /api/user/5ea1b63385dffb57120720c3/interactions HTTP/1.1 HOST: giuseppe-desolda.ddns.net:8080
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [ { "_id": "5ea1bc9a85dffb571207298e", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657878562, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} }, { "_id": "5ea1bc9a85dffb571207298f", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657878685, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} }, { "_id": "5ea1bc9a85dffb5712072990", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657878810, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} } ]
- Parameters
id – The id of the user
- Status Codes
200 OK – No error
-
GET
/api/user/
(str: id)/interactions/
(int: skip)-
(int: limit)¶ Get the first limit interactions starting from the skip of the user with id id.
Example request:
GET /api/user/5ea1b63385dffb57120720c3/interactions/6-2 HTTP/1.1 HOST: giuseppe-desolda.ddns.net:8080
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [ { "_id": "5ea1bc9a85dffb5712072994", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657879177, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} }, { "_id": "5ea1bc9a85dffb5712072995", "k": { "a": false, "f": false, "n": false, "s": false }, "m": { "b": { "l": false, "r": false, "m": false }, "p": [ 0, 0 ] }, "s": { "a": [ 0, 400 ], "r": [ 100, 400 ] }, "t": 1587657879295, "u": "https://www.repubblica.it/", "ui": "5ea1b63385dffb57120720c3", "w": [ 1537, 956 ], "e": {} } ]
- Parameters
skip – The number of interactions to skip
limit – The number of interactions to return
id – The id of the user
- Status Codes
200 OK – No error
Websites¶
Index¶
APIs¶
-
GET
/api/websites
¶ Get all the visited websites and the number of visits received.
Example request:
GET /api/websites HTTP/1.1 HOST: giuseppe-desolda.ddns.net:8080
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [ { "count": 876, "url": "https://zoom.us/", "category": "UNKNOWN" }, { "count": 1502, "url": "https://wwwapd.ict.uniba.it/", "category": "Università/Università di Bari" }, { "count": 796, "url": "https://www.zamzar.com/", "category": "Data Formats/Conversion" } ]