API

Description

This application provides a REST API allowing users to get port similarities on different time windows.

This API allows multiple features:

Time window distance dataset designation

Each day, four new datasets are added to this API.

  1. Last day
  2. Last week
  3. Last month
  4. Last year

Thus each one need a specific designation in order to be uniquely addressable.

The selected designation for a dataset from 15 March 2018 to 21 March 2018 is : sim-20180315-20180321

Documentation

Existing time windows

Returns existing time windows

Request GET /api/timewindows
Example Request GET /api/timewindows
Example Response

[
    {
        "from": 20171231,
        "to": 20180101,
        "duration": "day",
        "designation": "sim-20171231-20180101"
    },
    {
        "from": 20171225,
        "to": 20171231,
        "duration": "week",
        "designation": "sim-20171225-20171231"
    },
    {
        "from": 20171201,
        "to": 20171231,
        "duration": "month",
        "designation": "sim-20171201-20171231"
    },
    {
        "from": 20170101,
        "to": 20171231,
        "duration": "year",
        "designation": "sim-20170101-20171231"
    }
]
                            

Download a time window distance dataset

Returns time window distance dataset as a CSV file

Request format GET /api/timewindow/:designation
Parameters
  1. The designation of a time window dataset
Example Request GET /api/timewindow/sim-20180315-20180321
Example Response If the dataset exists, you are redirected to the appropriate file compressed in GZ format. Otherwise, an HTTP 404 is returned The given CSV file contains the 50.000.000 lowest semantic distances for the selected time window

CSV columns are :

  1. Source port
  2. Destion port
  3. Distance

List known ports of a time window distance dataset

Returns a list of integer representing port numbers

Request format GET /api/timewindow/:designation/ports
Parameters
  1. The designation of a time window dataset
Example Request GET /api/timewindow/sim-20180315-20180321/ports
Example Response The following response is returned if the dataset exists :

[
    80,
    443,
    ...
]
                            
Otherwise, an HTTP 404 is returned

Query the distance between two ports in a time window distance dataset

Returns JSON object containing information about distance between the two ports

Request format GET /api/timewindow/:designation/distance/:from/:to
Parameters
  1. The designation of a time window dataset
  2. Starting port
  3. Destination port
Example Request GET /api/timewindow/sim-20180315-20180321/distance/80/443
Example Response The following response is returned if the two ports exists and the dataset exists :

{
    "from": 80,
    "to": 443,
    "distance": 0.015
}
                            
Otherwise, an HTTP 404 is returned