Analysis Endpoints
  • 14 Apr 2022
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Analysis Endpoints

  • Dark
    Light
  • PDF

Article Summary

These endpoints provide the ability to retrieve the results of analyses and perform new analyses.

Analyze Project - Initiates a new analysis of a single project.
Analyze Projects - Initiates new analyses of one or more projects.
Get Analysis - Retrieve the analysis results of a single analysis.
Get Analysis Status - Retrieve the status of an analysis and a summary of each of the scans.
Get Project History - Retrieve a summary of all the analyses of a project that occurred in the past year.


Analyze Project

The /v1/scanner/analyzeProject endpoint allows you to initiate an analysis of a single project.

Endpoint
v1/scanner/analyzeProject
Request Method
POST
ParameterDescription
team_idYour team ID.
project_idThe project ID.
branch(optional) A branch other than the project's existing branch may be applied to this analysis. A branch may only be specified in a Git project.

Request Example:

curl -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer TOKEN" \
-d '{
     "team_id":"TEAM_ID",
     "project_id":"PROJECT_ID"
}' \
https://api.ionchannel.io/v1/scanner/analyzeProject

Response Example:

{
  "data": {
    "id": "abcd1234-ab12-ab12-ab12-abcde123456",
    "team_id": "abcd1234-ab12-ab12-ab12-abcde123456",
    "project_id": "abcd1234-ab12-ab12-ab12-abcde123456",
    "message": "Request for analysis abcd1234-ab12-ab12-ab12-abcde123456 on Project Name has been queued.",
    "branch": "master",
    "status": "queued",
    "unreachable_error": false,
    "analysis_event_src": "",
    "created_at": "2022-02-15T22:28:57.878184Z",
    "updated_at": "2022-02-15T22:28:57.878184Z",
    "scan_status": null,
    "deliveries": null
    "ForCukes": false
  },
  "meta": {
    "total_count": 0,
    "offset": 0
  }
}

Analyze Projects

The v1/scanner/analyzeProjects endpoint allows you to initiate analyses on multiple projects.

Endpoint
v1/scanner/analyzeProjects
Request Method
POST
ParameterDescription
project_idThe project IDs.

Request Example

curl -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer TOKEN" \
-d '[
  {
    "project_id": "abcd1234-ab12-ab12-ab12-abcde123456"
  },
  {
    "project_id": "bcde1234-ab12-ab12-ab12-abcde234567"
  }
]' \
"https://api.ionchannel.io/v1/scanner/analyzeProjects"

Response Example

See Analyze Project.


Get Analysis

The v1/report/getAnalysis endpoint returns the analysis report for a single project's specified analysis.

Endpoint
v1/report/getAnalysis
Request Method
GET
ParameterDescription
analysis_idThe analysis ID.
team_idYour team ID.
project_idThe project ID.

Request Example

curl -H "Authorization: Bearer TOKEN" \
https://api.ionchannel.io/v1/report/getAnalysis?analysis_id=ANALYSIS_ID&team_id=TEAM_ID&project_id=PROJECT_ID

Response Example


Get Analysis Status

The v1/scanner/getAnalysisStatus endpoint returns the status of an analysis and a summary of each of the scans.

Endpoint
v1/scanner/getAnalysisStatus
Request Method
GET
ParameterDescription
idThe analysis ID.
team_idYour team ID.
project_idThe project ID.

Request Example

curl -H "Authorization: Bearer TOKEN" \
https://api.ionchannel.io/v1/scanner/getAnalysisStatus?id=ANALYSIS_ID&team_id=TEAM_ID&project_id=PROJECT_ID

Response Example


Get Project History

The v1/project/getProjectHistory endpoint returns a summary of the analyses taken each day in the past year. This information includes the IDs of the project and analyses, whether the last analysis of the day passed or failed governance, the number of passing/failing analyses on that day, and whether the ruleset changed for any analysis (status_flipped).

Endpoint
v1/project/getProjectHistory
Request Method
GET
ParameterDescription
project_idThe project ID.

Request Example

curl -H "Authorization: Bearer TOKEN" \
https://api.ionchannel.io/v1/ruleset/getProjectHistory?project_id=PROJECT_ID

Response Example

{
  "data": [
    {
      "team_id": "bcde1234-ab12-ab12-ab12-abcde234567",
      "project_id": "abcd1234-ab12-ab12-ab12-abcde123456",
      "analysis_id": "cdef1234-ab12-ab12-ab12-abcde345678",
      "pass": true,
      "fail_count": 0,
      "pass_count": 1,
      "created_at": "2022-02-15T22:30:01.548838Z",
      "status_flipped": false
    },
    {
      "team_id": "bcde1234-ab12-ab12-ab12-abcde234567",
      "project_id": "abcd1234-ab12-ab12-ab12-abcde123456",
      "analysis_id": "defg1234-ab12-ab12-ab12-abcde456789",
      "pass": false,
      "fail_count": 1,
      "pass_count": 1,
      "created_at": "2022-02-14T12:03:44.778551Z",
      "status_flipped": true
    },
  ],
  "meta": {
    "total_count": 2,
    "offset": 0
  }
}

Was this article helpful?