Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

DRAT Proteus REST API

Ahmed Ifhaam edited this page Jun 10, 2018 · 6 revisions

Proteus Mid-tier REST API Design

You can also find the API on APIary.io.

Base endpoint:

/proteus

Starting DRAT API

./drat/go POST

Starts the "go" operation on DRAT given a directory. Returns: nothing Request Body: { "dirPath":$_DIRPATH } where $_DIRPATH is the path to the repo you want to analyze

./drat/index POST

Starts the "index" operation on DRAT given a directory. Request Body: { "dirPath":$_DIRPATH } where $_DIRPATH is the path to the repo you want to analyze

./drat/crawl POST

Starts the "crawl" operation on DRAT given a directory. Request Body: { "dirPath":$_DIRPATH } where $_DIRPATH is the path to the repo you want to analyze

./drat/map POST

Starts the "map" operation on DRAT given a directory. Request Body: { "dirPath":$_DIRPATH } where $_DIRPATH is the path to the repo you want to analyze

./drat/reduce POST

Starts the "reduce" operation on DRAT given a directory. Request Body: { "dirPath":$_DIRPATH } where $_DIRPATH is the path to the repo you want to analyze

Services API

./service/products?topn=? GET

Request parameters: (Optional) topn: A number specifying at most how many results should be returned. Returns a JSON array containing the last topn (defaults to 20) products ingested by DRAT from the repo of the form:

[{
	title: String,
	pubDate: String,
	casSource: String,
	source: String,
	link: String 
}]

./service/status/oodt GET

Returns OODT status as an object of the form:

boolean {true or false}

./service/status/drat GET

Returns DRAT status as an object of the form:

String/Enum representing the current state {CRAWL, INDEX, MAP, REDUCE, RESET, IDLE}

./service/status/oodt/raw GET

Returns the raw JSON data from Oodt’s Health Monitor Service (output example here)

./service/repo/breakdown/mime?limit=?

Request parameters: (Optional) limit: A number specifying at maximum how many results should be returned. Returns a breakdown (graphable) of the mime types of the files in the currently ingested repository. This action occurs >during DRAT’s “CRAWL” step, and as such before CRAWL the default response will be an empty array (no data). A successful response return a JSON array of the form:

[{
	type: String,
	numberOfObjects: Number,
	weight: Number
}]

Type in this case refers to the Mime-type found in the repo (e.g. “application/json”), numberOfObjects refers to how many >of that type were found in the repo, and weight is calculated by dividing numberOfObjects by the total number of objects >found in the repo (showing its relative weight in representation of mime-types).

./service/repo/breakdown/license?limit=?

Request parameters: (Optional) limit: A number specifying at maximum how many results should be returned. Returns a breakdown (graphable) of the license types of the files in the currently ingested repository. This action occurs >during DRAT’s MAP/REDUCE steps, and as such before MAP the default response will be an empty array (no data). A successful response return a JSON array of the form:

[{
	type: String,
	numberOfObjects: Number,
	weight: Number
}]

Type in this case refers to the License-type found in the repo (e.g. “Apache License”), numberOfObjects refers to how many >of that type were found in the repo, and weight is calculated by dividing numberOfObjects by the total number of objects >found in the repo (showing its relative weight in representation of license-types).

./service/repo/size?dir=? GET

Request parameters: (Optional) dir: A canonical path on the host computer. If not provided, dir defaults to >$DRAT_HOME/data/staging/uploaded_repo, which is where by default Proteus uploads uncompressed zip files for analysis to. Returns:

{ 
numberOfFiles: Number, 
memorySize: Number 
}

./service/repo/licenses/unapproved GET

Returns a JSON Array mapping RAT running instances (e.g. individual RatLogs) to files where licenses have been found that >are unapproved for use in the project. A response will take the form of a JSON array with objects as the following:

[{
	ratId: Number,
	unapprovedFiles: Array
}]

ratId in this case refers to a numbering given (not guaranteed to be in-order, but a quick way of identification) to a >RatAuditTask that generates a RatLog which was parsed. unapprovedFiles is an array of Strings that list the file locations >where, for that given RatAuditTask, unapproved licenses were found to be used.

Workflow Services

./workflowservice/dynamic POST

Starts dynamic workflow with given tasks Request Body: {taskIds:["urn:drat:MimePartitioner"]} here property taskIds, is a list of ids. Returns : "OK" If every thing is fine otherwise returns the exception message.