Darth VDR - Virtual Data Room

General notes

API detail

createFunction

Use this API to create a new Function for the FIU. The FIU is expected to poll the getFunctionDetails API to check status of the Function before requesting a new Job.

curl --location --request POST '/vdr/createFunction'
--form 'function=@/path/to/file'
--form 'fiuId=FIU_ID'
--form 'jsonSchema={\"jsonSchema\": \"\"}'
--form 'handler'= 'handler name"'
--form 'runtime'= "envrionment name" //e.g python 3,java 8
--form 'functionName'= 'function Name'
--form 'functionDescription': 'function Description'
var request = require('request');
var fs = require('fs');
var options = {
  'method': 'POST',
  'url': '/vdr/createFunction',
  'headers': {
  },
  formData: {
    'function': {
      'value': fs.createReadStream('/path/to/file'),
      'options': {
        'filename': 'filename'
        'contentType': null
      }
    },
    'fiuId': 'FIU_ID',
    'jsonSchema': '{"jsonSchema": ""}',
	'handler': 'handler name"',
	'runtime': "envrionment name" //e.g python 3,java 8,
	'functionName': 'function Name',
	'functionDescription': 'function Description'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
Status202 Accepted
{
    "functionId": "FUNCTION_ID"
}

getFunctionsByFiuId

Use this API to get a list of all the Functions created by the FIU.

curl -X GET "/vdr/getFunctionsByFiuId?fiuId=FIU_ID"
var request = require('request');
var options = {
  'method': 'GET',
  'url': '/vdr/getFunctionsByFiuId?fiuId=FIU_ID',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
Status200 OK
{
    "fiuId": "FIU_ID",
    "functions": {
        "FUNCTION1_ID": {
            "functionId": "FUNCTION1_ID",
            "jsonSchema": "",
            "state": "AVAILABLE",
            "created": "UTC DateTime String",
            "lastUpdated": "UTC DateTime String",
			"functionName": "function name",
            "functionDescription": "function description",
            "handler": "handler name",
            "runtime": "envrionment name" //e.g python 3,java 8
        },
        "FUNCTION2_ID": {
            "functionId": "FUNCTION2_ID",
            "jsonSchema": "",
            "state": "UNAVAILABLE",
            "created": "UTC DateTime String",
            "lastUpdated": "UTC DateTime String",
			"functionName": "function name",
            "functionDescription": "function description",
            "handler": "handler name",
            "runtime": "envrionment name" //e.g python 3,java 8
        },
        "FUNCTION3_ID": {
            "functionId": "FUNCTION3_ID",
            "jsonSchema": "",
            "state": "FAILED",
            "created": "UTC DateTime String",
            "lastUpdated": "UTC DateTime String",
			"functionName": "function name",
            "functionDescription": "function description",
            "handler": "handler name",
            "runtime": "envrionment name" //e.g python 3,java 8
        }
    }
}

getFunctionDetails

Use this API to get details of a particular Function given an ID of the Function.

curl -X GET "/vdr/getFunctionDetails?functionId=FUNCTION_ID"
var request = require('request');
var options = {
  'method': 'GET',
  'url': '/vdr/getFunctionDetails?functionId=FUNCTION_ID',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
Status200 OK
{
    "fiuId": "FIU_ID",
    "functions": {
        "FUNCTION_ID": {
            "functionId": "FUNCTION1_ID",
            "jsonSchema": "",
            "state": "AVAILABLE",
            "created": "UTC DateTime String",
            "lastUpdated": "UTC DateTime String",
			"functionName": "function name",
            "functionDescription": "function description",
            "handler": "handler name",
            "runtime": "envrionment name" //e.g python 3,java 8
        }
    }
}

updateFunction

Use this API to update existing Function for the FIU.

curl --location --request PUT '/vdr/updateFunction'
--form 'function=@/path/to/file'
--form 'fiuId=FIU_ID'
--form 'jsonSchema={\"jsonSchema\": \"\"}'
--form 'handler'= 'handler name"'
--form 'runtime'= "envrionment name" //e.g python 3,java 8
--form 'functionName'= 'function Name'
--form 'functionDescription': 'function Description'
var request = require('request');
var fs = require('fs');
var options = {
  'method': 'PUT',
  'url': '/vdr/updateFunction',
  'headers': {
  },
  formData: {
    'function': {
      'value': fs.createReadStream('/path/to/file'),
      'options': {
        'filename': 'filename'
        'contentType': null
      }
    },
    'fiuId': 'FIU_ID',
    'jsonSchema': '{"jsonSchema": ""}',
	'handler': 'handler name"',
	'runtime': "envrionment name" //e.g python 3,java 8,
	'functionName': 'function Name',
	'functionDescription': 'function Description'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
Status202 Accepted
{
    "functionId": "FUNCTION_ID"
}

createJob

Use this API to create a new Job for a particular Function for a particular user with a AA ID. The FIU is expected to poll the getFunctionDetails API to check status of the Function before requesting a new Job.

curl --location --request POST '/vdr/createJob'
--form 'fiuId=FIU_ID'
--form 'functionId=FUNCTION_ID'
--form 'aaId=AA_ID'
--form 'requestParams={\"aaId\": \"\"}' 
var request = require('request');
var options = {
  'method': 'POST',
  'url': '/vdr/createJob',
  'headers': {
  },
  formData: {
    'function': {
      'value': fs.createReadStream('/path/to/file'),
      'options': {
        'filename': 'filename'
        'contentType': null
      }
    },
    'fiuId': 'FIU_ID',
    'functionId=FUNCTION_ID',
    'aaId=AA_ID',
    'requestParams={\"aaId\": \"\"}'
    
  }

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
Status202 Accepted
{
    "jobId": "JOB_ID"
}

getJobsByFiuId

Use this API to get a list of all the Jobs requested by the FIU.

curl -X GET "/vdr/getJobsByFiuId?fiuId=FIU_ID"
var request = require('request');
var options = {
  'method': 'GET',
  'url': '/vdr/getJobsByFiuId?fiuId=FIU_ID',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
Status200 OK
{
    "fiuId": "FIU_ID",
    "jobs": {
        "JOB1_ID": {
            "jobId": "JOB1_ID",
            "functionId": "FUNCTION1_ID",
            "aaId": "AA1_ID",
            "state": "CREATED",
            "created": "UTC DateTime String",
            "lastUpdated": "UTC DateTime String"
        },
        "JOB2_ID": {
            "jobId": "JOB2_ID",
            "functionId": "FUNCTION2_ID",
            "aaId": "AA1_ID",
            "state": "PROCESSING",
            "created": "UTC DateTime String",
            "lastUpdated": "UTC DateTime String"
        },
        "JOB3_ID": {
            "jobId": "JOB3_ID",
            "functionId": "FUNCTION1_ID",
            "aaId": "AA2_ID",
            "state": "FAILED",
            "created": "UTC DateTime String",
            "lastUpdated": "UTC DateTime String"
        }
    }
}

getJobDetails

Use this API to get details of a particular Job given an ID of the Job.

curl -X GET "/vdr/getFunctionDetails?jobId=JOB_ID"
var request = require('request');
var options = {
  'method': 'GET',
  'url': '/vdr/getFunctionDetails?jobId=JOB_ID',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
Status200 OK
{
    "fiuId": "FIU_ID",
    "jobs": {
        "JOB1_ID": {
            "jobId": "JOB1_ID",
            "functionId": "FUNCTION1_ID",
            "aaId": "AA1_ID",
            "state": "SUCCESS",
            "result": "{ \"data\": { \"canProvideLoan\": true } }",
            "created": "UTC DateTime String",
            "lastUpdated": "UTC DateTime String"
        }
    }
}