← Back to catalog

Other

LGTM API specification

auto-generated
swirls add lgtm
actionPOSTv1.0.0

Add a project to LGTM

LGTM administrators can add a new project to LGTM by providing a repository URL. By default, LGTM tries to build and analyze the project in the same way as for projects added through the user interface. If at least one language is successfully analyzed, and the repository doesn't already exist on LGTM, a new project is created. If the project already exists but your API call triggers a successful analysis of additional languages, LGTM adds those languages to the project. You can configure how LGTM processes the project using query parameters to: * Specify the languages to analyze. * Create a new project in [sparse mode](https://help.semmle.com/lgtm-enterprise/user/help/analysis-faqs.html#what-is-sparse-analysis). * Create a new project in [upload mode](https://help.semmle.com/lgtm-enterprise/user/help/analysis-faqs.html#what-is-upload-analysis) to analyze externally-generated databases. Each database represents a snapshot of the codebase. Use this option when you want to upload databases that were generated by the CodeQL CLI (or the QL command-line tools). The version of the command line used to generate the database must be the same version as LGTM Enterprise. With any of these options, you can also include an `lgtm.yml` in the body of the request to [customize extraction](https://lgtm.com/help/lgtm/customizing-code-extraction).

Source
actionGETv1.0.0

API specification

Get the specification of this API in [OpenAPI](https://github.com/OAI/OpenAPI-Specification) format. This endpoint does not require an access token. This makes it easier for you to use the specification with third-party tools.

Source
actionDELETEv1.0.0

Delete project by numeric identifier

Delete a project with a particular numeric project identifier. In addition to access to the project, administrative access to LGTM or the LGTM Enterprise instance is required to delete projects.

Source
actionGETv1.0.0

Fetch the results of a query job for a specific project

Fetch the results for a specific project. The endpoint succeeds only if the query was successful, and returns a `404` error otherwise. By default, the endpoint provides only results that are within the source tree. To obtain all results, specify the `nofilter` parameter.

Source
actionGETv1.0.0

Get analysis summary

Get a summary of the analysis results for a specific analysis identifier. To find the analysis identifier for a commit, use the `/analyses/{project-id}/commits/{commit-id}` endpoint. For more information, see [Get analysis summary for a specific commit](https://lgtm.com/help/lgtm/api/api-v1#opIdgetAnalysisForCommit). This endpoint reports the commit analyzed and a summary of the results for each language. Alternatively, you can use this identifier to download full details of all the alerts found by the analysis. For more information, see [Get detailed alert information](https://lgtm.com/help/lgtm/api/api-v1#opIdgetAlerts).

Source
actionGETv1.0.0

Get analysis summary for a specific commit

Get a summary of the analysis results for a specific commit, or the latest commit, to a project. (For projects configured for sparse or upload analysis, only `latest` is supported.) This endpoint reports a summary of results for each language, and also the analysis identifier. You can use the analysis identifier to download full details of all the alerts found by the analysis. For more information, see [Get detailed alert information](https://lgtm.com/help/lgtm/api/api-v1#opIdgetAlerts).

Source
actionGETv1.0.0

Get detailed alert information

Download all the alerts found by an analysis. Use the `Accept:` request header to specify the output media type as either CSV or [SARIF](https://lgtm.com/help/lgtm/sarif-results-file): - `application/sarif+json`: Alerts in SARIF format. If no version is specified the latest supported SARIF version is used. - `application/json`: Alerts in SARIF format (*deprecated*). If no version is specified, [SARIF 2.0.0](http://docs.oasis-open.org/sarif/sarif/v2.0/sarif-v2.0.html) is used for backwards compatibility. - `text/csv`: Alerts in CSV format. The `text/csv` media type has two optional parameters: - `charset`: determines the character encoding of the text, by default UTF-8. - `header`: determines whether a header row with column names is `present` or `absent`. The default value for this parameter is `present`. For example, an Accept header with value `text/csv; header=absent` would result in CSV output without a header row. To find the analysis identifier for a commit, use the `/analyses/{project-id}/commits/{commit-id}` endpoint. For more information, see [Get analysis summary for a specific commit](https://lgtm.com/help/lgtm/api/api-v1#opIdgetAnalysisForCommit).

Source
actionGETv1.0.0

Get operation status

Track progress of a long-running operation using the operations identifier returned when you created the operation. For example, by triggering the analysis of a commit, or the code review of a patch. For both LGTM.com and LGTM Enterprise, you must include an access token with the `operations:read` scope.

Source
actionGETv1.0.0

Get project by numeric identifier

Get the latest summary for a specific project using the numeric project identifier. To find the LGTM identifier for a project, list all projects using the `/projects` endpoint and look up the project by name. Alternatively, use the `/projects/{provider}/{org}/{name}` endpoint. If you have administration access, the project identifier is also displayed in the administration page for the project.

Source
actionGETv1.0.0

Get project by URL identifier

Get the latest summary for a specific project using the project's URL identifier `{provider}/{org}/{name}`. To find the URL identifier for a project, view the project overview page in LGTM. The URL identifier follows after `/projects`. For example, for a project with the URL `https://lgtm.example.com/projects/g/apache/commons-io` the URL identifier is `g/apache/commons-io`. In the example, `g` represents the `provider` (repository host), `apache` is the `organization` and `commons-io` is the `name` of the repository.

Source
actionGETv1.0.0

Get results of code review

Get the results of a code review using the review identifier for the task. When you request a code review, the response includes a task result URL of the form: `/codereviews/{review-id}`. This endpoint reports the results of a complete code review, or the status of a review that's still in progress.

Source
actionGETv1.0.0

Get the computed values of the specified metric

LGTM administrators can download usage data using this endpoint. The response includes up to 1000 values for the specified metric and reports the date-time that each value was calculated. There is normally one value per day.

Source
actionGETv1.0.0

Get the status of a query job

Get the status of a query job using the query job identifier for the task. When you create a query job, the response includes a task result URL of the form: `/queryjobs/{queryjob-id}`.

Source
actionGETv1.0.0

List projects

List all the projects the current user has authorization to view. A maximum of 100 projects are returned in each response. When further results are available, the response includes the URL you need to request the next page of results. Use the optional parameter, `limit`, to change the number of results reported in each response (range of 1—100). If you supply an invalid value for this parameter, the default value of 100 is used. When more than one page of results is available, each response includes a `nextPageUrl` response parameter. You can use this URL to request the next page of results. The `nextPageUrl` includes an automatically generated `start` parameter, which specifies the projects to return in the next page of results.

Source
actionGETv1.0.0

Provide a summary of results for the projects in the query job

This endpoint provides a summary of the results generated by completed query runs for each project specified in the the POST /queryjobs endpoint. For completed query jobs, the summary includes: * The number of results for successful query runs. * Error information for failed query runs. No information is included in the response for any project for which the query run is still in progress.

Source
actionPOSTv1.0.0

Run analysis of a specific commit

Trigger the analysis of a specific commit to a project. If a previous attempt to analyze that commit failed, this triggers a fresh analysis. This is supported for all LGTM projects, regardless of repository type or host. The commit must be available in the main repository, but can be on a branch that isn't tracked by LGTM. For both LGTM.com and LGTM Enterprise, you must include an access token with the `analyses:write` scope. When you request the analysis of a commit, the API returns: - `operation-id`: used to track the status of the task using the `/operations` endpoint. For more information, see [Get operation status](https://lgtm.com/help/lgtm/api/api-v1#opIdgetOperation). - `status`: initially pending. - `task-result`: containing information about the progress and results of the analysis.

Source
actionPOSTv1.0.0

Run code review for a patch

Trigger the code review of a patch. This is available for projects with Git repositories. Your request must include: * Identifier for the base commit * Patch generated using `git diff --binary` (see [git diff](https://git-scm.com/docs/git-diff)) * Header `Content-Type: application/octet-stream` * For both LGTM.com and LGTM Enterprise, an access token with the `codereviews:write` scope Note that if you make a request using Curl, you'll also need to add `--data-binary` to the request to ensure that the patch you supply in the body is sent with newlines unchanged. You can track the progress of the review using the task result URL returned on creation of the task, or by calling the `/operations` endpoint with the operations identifier returned by the request. For more information, see [Get operation status](https://lgtm.com/help/lgtm/api/api-v1#opIdgetOperation). Alternatively, if you supply a callback URL you'll get a post-back automatically on completion of the review. When the review is complete, you can access the results using the task result URL.

Source
Beyond the catalog

Any provider, on request.

01

Request it

Tell us which provider you need, and we will ship it in the registry.

02

Generate it

Point swirls add at an OpenAPI or GraphQL spec. Typed actions for any API you hold credentials for, today.

acme · integrations
terminal
~/acme $swirls add linear
✓ 12 typed actions · scopes and schemas included
 
~/acme $swirls add https://api.acme.dev/openapi.json
◆ Fetched spec · 38 operations
✓ 6 typed actions · generated from spec