Skip to content

Latest commit

 

History

History
209 lines (151 loc) · 5.35 KB

API.md

File metadata and controls

209 lines (151 loc) · 5.35 KB

CodeReady Analytics Core API Specifications

CodeReady Analytics is an open-source analytics platform aimed primarily at assisting developers in getting insights and recommendations on the selected dependency or package stack used for developing their applications.

This documentation is for developers who are interested in integrating their services or applications with CodeReady Analytics platform.

Supported ecosystems

Currently, CodeReady Analytics supports the following ecosystems. We will add support for more ecosystems in the near future.

Ecosystem Manifest file
Java Maven pom.xml
Python Pypi requirements.txt
NodeJS NPM package.json

Prerequisites

To integrate with the CodeReady Analytics platform, you need to use an existing 3-scale API management gateway. Create an issuehereto reach out to us for the API management gateway.

Initiate Dependency Analysis

  • Purpose

    Submits a dependency stack analysis request

  • URL https://<3scale-api-gateway-url>/api/v1/stack-analyses

  • Method POST

  • Response Format jSON

  • Path Parameters None

  • Query Parameters

    Name Required Description Example
    user_key required 3-scale API management authorization user key. 421249d63
  • Form Data

    Name Required Description Example
    manifest[] required Ecosystem specific Manifest file(s) available in the application. One can provide multiple manifest files to invoke the method. @pom.xml
    filePath[] required Corresponding manifest file’s directory information. Care has to be taken to map the manifest filenames and file paths correctly. /home/JohnDoe
  • Headers

    Name Required Description Example
    source required Source of the request. "vscode"
    ecosystem required Ecosystem maven/pypi/npm
  • Sample Request with cURL

    $ curl -k -F "manifest[]=@./pom.xml" -F "filePath[]=/home/JohnDoe" https://https://api-244552094075730.prod.gw.apicast.io:443/api/v1/stack-analyses/?user_key=421249d63
    
  • Sample Responses

    Success

        {
        "id": "421249d9e1e5464cbf3e77dde4941463",
        "status": "success",
        "submitted_at": "2017-10-20 05:09:01.165068"
        }
    

    Failure

        400:
            {
                "error": "Bad request"
            }
    
        401:
            {
                "error": "Authentication failed - could not decode JWT token"
            }
    

Fetch Dependency Analysis

  • Purpose

    Fetches the dependency stack analysis response using the request identifier returned by the initiated dependency analysis.

  • URL https://<3scale-api-gateway-url>/api/v1/stack-analyses/{request ID}

  • Method GET

  • Response Format jSON

  • Path Parameters

    Name Required Description Example
    {request ID} required Request identifier returned by /stack-analyses POST. 421249d9e1e5464cbf3e77dde4941463
  • Query Parameters

    Name Required Description Example
    user_key required 3-scale API management authorization user key. 421249d63
  • Sample Request with cURL

    $ curl -k https://https://api-244552094075730.prod.gw.apicast.io:443/api/v1/stack-analyses/421249d9e1e5464cbf3e77dde4941463 
    
  • Sample Responses

    Success

    Sample success reponse is here

    In Progress

        202:
        {
            "error": "Analysis for request ID '510a314561104e8ba14bac489b31efe0' is in progress"
        }
    

    Failure

        400:
        {
            "error": "Bad request"
        }
    

Single Dependency Analysis

  • Purpose

    Fetches various data points and recommendations for a given dependency.

  • URL https://<3scale-api-gateway-url>/api/v1/component-analyses/{ecosystem}/{name}/{version}

  • Method GET

  • Response Format jSON

  • Data Parameters None

  • Path Parameters

    Name Required Description Example
    ecosystem required Ecosystem maven/pypi/npm
    name required Name of the package bootstrap/io.vertx:vertx-core
    version required version of the package 3.4.1
  • Sample Request with cURL

    $ curl -k https://api-244552094075730.prod.gw.apicast.io:443/api/v1/component-analyses/maven/io.vertx:vertx-core/3.4.1
    
  • Sample Responses

    Success

    Sample success reponse is here

    In Progress

        202:
        {
            "error": "Package npm/serve-static/1.7.x is unavailable. The package will be available shortly, please retry after some time."
        }
    

    Failure

        400:
        {
            "error": "Bad request"
        }
    
        401:
        {
            "error": "Authentication failed - could not decode JWT token"
        }
    
        404:
        {
            "error": "No data found for maven Package io.vertx:vertx-core/3.4.1"
        }