Skip to content

Specification

Kapil Gupta edited this page Jul 26, 2017 · 1 revision

API (server side)

Authentication

  1. '/login'

input : (req)
output : (res)

Takes in the request from the client, and then sends the required response. The checking is done by observing the validity of the address sent to the server. Response comprises of a JSON Token with a timed validity sequence.

  1. '/finishLogin'

input : (validateJwt, res)
output : (res)

Takes in the 'validateJwt' function's output along with the request and confirms or denies login into the account.

  1. '/createNB'

input : (req, configFile.conf)
output : (res)

Takes in the request along with a configuration file. The configuration file should contain the location where the notebook is stored along with any other details that are valid and required by the server. Response comprises of the success or failure confirmation with an error message, if needed.

  1. '/deleteNB'

input : (req)
output : (res)

Takes in the request for deletion of the notebook along with any other details that are needed. Response comprises of the success or failure confirmation with an error message, if needed.

  1. '/askPermNB'

input : (req)
output : (res)

Takes in the request for asking of permission for access to a notebook along with other details that are needed. Response comprises of the success or failure confirmation with an error message, if needed.

  1. '/createData'

input : (req, configFile.conf)
output : (res)

Takes in the request along with a configuration file. The configuration file should contain the location where the data is stored along with any other details that are valid and required by the server. Response comprises of the success or failure confirmation with an error message, if needed.

  1. '/deleteData'

input : (req)
output : (res)

Takes in the request for deletion of the data along with any other details that are needed. Response comprises of the success or failure confirmation with an error message, if needed.

  1. '/askPermData'

input : (req)
output : (res)

Takes in the request for access rights and download rights to the Data. Response comprises of the success or failure confirmation with an error message, if needed.

  1. '/buyData'

input : (req)
output : (res)

Data can be bought by using this api. The request comprises of information needed for buying of data.

Response comprises of the success or failure confirmation with an error message, if needed.

Sample API responses
  1. POST : /login
response {
    challenge : 'a collision resistant id',
    jwt : json token
}

Error Status Codes :

400 : Address not found in registry. Register first, login later.

  1. POST : /finishLogin
response {
    jwt : token,
    address : req.jwt.address
}

Error Status Codes :

400 : Address not found in registry. Register first, login later.
202 : HTTP request accepted, but operation not completed.

  1. POST : /createNB
response {
    'location' : URI of the notebook
}

Error Status Codes :

401 : Unauthorized Access, not granted

  1. POST : /deleteNB
response {
    'success' : 'true'
}

Error Status Codes :

400 : Notebook not found
401 : Unauthorized access
202 : request accepted, but operation not completed

  1. POST : /askPermNB
response {
    'access' : true,
    'key' : 'hashed key for signing'
}

response {
    'access' : false
}

Error Status Codes :

400 : Notebook not found
202 : request accepted, but operation not completed

  1. POST : /createData
response {
    'location' : URI of the notebook
}

Error Status Codes :

401 : Unauthorized Access, not granted

  1. POST : /deleteData
response {
    'success' : 'true'
}

Error Status Codes :

400 : Notebook not found
401 : Unauthorized access
202 : request accepted, but operation not completed

  1. POST : /askPermData
response {
    'access' : true,
    'key' : 'hashed key for signing'
}

response {
    'access' : false
}

400 : Notebook not found
202 : request accepted, but operation not completed

  1. POST : /buyData
response {
    'permission' : true,
    'location' : 'URI of data'
}

response {
    'permission' : false
}

Error Status Codes :

400 : Notebook not found
401 : Unauthorized access
202 : request accepted, but operation not completed

[TODO: update API]

Clone this wiki locally