Skip to content

LGTM API specification API

by lgtm.com

Bearer tokenHTTPSDevelopment
Open documentation ↗

Overview

The REST API for LGTM provides data so that you can customize how you integrate LGTM analysis into your workflow. It includes the following resources: * `/` ([API root](https://lgtm.com/help/lgtm/api/api-v1#LGTM-API-specification-API-root))—get version information or download the specification in OpenAPI format. * `/projects` ([Projects](https://lgtm.com/help/lgtm/api/api-v1#LGTM-API-specification-Projects))—list projects, get a summary of the current status for a project, or add new projects. * `/analyses` ([Analyses](https://lgtm.com/help/lgtm/api/api-v1#LGTM-API-specification-Analyses))—get a summary of results, download all the alerts, or trigger analysis for a specific commit. * `/codereviews` ([Code reviews](https://lgtm.com/help/lgtm/api/api-v1#LGTM-API-specification-Code-reviews))—trigger code review for a patch, and view the results. * `/operations` ([Operations](https://lgtm.com/help/lgtm/api/api-v1#LGTM-API-specification-Operations))—get information about long-running tasks, for example, analyses or code reviews that you've requested. * `/snapshots` ([Snapshots](https://lgtm.com/help/lgtm/api/api-v1#LGTM-API-specification-Snapshots))—download and upload databases representing a snapshot of a codebase. * `/queryjobs` ([Query jobs](https://lgtm.com/help/lgtm/api/api-v1#LGTM-API-specification-Query-jobs))—submit queries to evaluate against existing projects, and download their results. * `/system` ([System](https://lgtm.com/help/lgtm/api/api-v1#LGTM-API-specification-System))—get information on the health or usage of the system. For an overview and getting started topics, see [API for LGTM](https://lgtm.com/help/lgtm/api/api-for-lgtm).

LGTM API specification is a development API from lgtm.com. Requests are authenticated with a bearer token. It is served over HTTPS. Its OpenAPI description documents 29 endpoints.

At a glance

Authentication
Bearer token
HTTPS
Yes
CORS
Unknown
Category
Development
Base URL
https://lgtm.com/api/v1.0
Version
v1.0
Endpoints
29
Spec updated
2021-06-21

Make a first request

Replace the placeholders; the documentation says exactly where credentials go.

cURL
curl -X GET "https://lgtm.com/api/v1.0/" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"
JavaScript
const response = await fetch("https://lgtm.com/api/v1.0/", {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "Authorization": "Bearer YOUR_TOKEN",
  },
});
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    "GET",
    "https://lgtm.com/api/v1.0/",
    headers={
    "Accept": "application/json",
    "Authorization": "Bearer YOUR_TOKEN",
    },
    timeout=30,
)
print(response.json())

Endpoints

MethodPathWhat it does
GET/Version information
GET/analyses/{analysis-id}Get analysis summary
GET/analyses/{analysis-id}/alertsGet detailed alert information
POST/analyses/{project-id}Run analysis of a specific commit
GET/analyses/{project-id}/commits/{commit-id}Get analysis summary for a specific commit
POST/codereviews/{project-id}Run code review for a patch
GET/codereviews/{review-id}Get results of code review
GET/issues/{project-id}/{alert-key}Get detailed alert information for an issue
GET/openapiAPI specification
GET/operations/{operation-id}Get operation status
GET/projectsList projects
POST/projectsAdd a project to LGTM
GET/projects/{project-id}Get project by numeric identifier
DELETE/projects/{project-id}Delete project by numeric identifier
GET/projects/{project-id}/settings/analysis-configurationGet configuration for a project identified by numeric identifier
PUT/projects/{project-id}/settings/analysis-configurationSet the administrator configuration for a project identified by numeric identifier
GET/projects/{provider}/{org}/{name}Get project by URL identifier
POST/queryjobsRun a CodeQL query on one or more projects
GET/queryjobs/{queryjob-id}Get the status of a query job
GET/queryjobs/{queryjob-id}/resultsProvide a summary of results for the projects in the query job
GET/queryjobs/{queryjob-id}/results/{project-id}Fetch the results of a query job for a specific project
POST/snapshots/uploads/{session-id}Complete snapshot upload session
PUT/snapshots/uploads/{session-id}Upload snapshot
DELETE/snapshots/uploads/{session-id}Abort database upload process
GET/snapshots/{project-id}/{language}Download a snapshot
POST/snapshots/{project-id}/{language}Start snapshot upload session
GET/system/healthGet a summary of the application's health
GET/system/metricsGet the identifiers and descriptions of the usage metrics
GET/system/metrics/{metric-id}Get the computed values of the specified metric

Questions

Does the LGTM API specification API need an API key?

Yes. The LGTM API specification API uses Bearer token authentication; the documentation explains how to get credentials.

Does the LGTM API specification API support HTTPS?

Yes, the LGTM API specification API is served over HTTPS.

How many endpoints does the LGTM API specification API have?

Its OpenAPI description lists 29 endpoints in version v1.0. All of them are shown on this page.

What are alternatives to the LGTM API specification API?

Other Development APIs include Cloudflare, Azure DevOps, IPify, App Store Connect API, StackExchange.

Compare alternatives →

Listed from APIs.guru (CC0).