Skip to content

DRAT Proteus REST API

Chris Mattmann edited this page Dec 9, 2015 · 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:

{
	isRunning: boolean
}

./service/status/drat GET

Returns DRAT status as an object of the form:

{
	currentState: String/Enum,
	progress: double,
	isRunning: boolean
}

isRunning will be true when currentState is either in CRAWL, INDEX, MAP, or REDUCE. currentState is an enum of the values >CRAWL, INDEX, MAP, REDUCE (DRAT active values) or IDLE (DRAT isn’t on) or INTERRUPTED (the last DRAT process had a return >value greater than 0).

./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.

Clone this wiki locally