curl --request POST \
--url https://api.codeant.ai/api/analysis/results/antipatterns \
--header 'Content-Type: application/json' \
--data '
{
"repo": "owner/repository",
"commit_id": "abc123def456",
"access_token": "ghp_xxxxxxxxxxxx",
"service": "github"
}
'import requests
url = "https://api.codeant.ai/api/analysis/results/antipatterns"
payload = {
"repo": "owner/repository",
"commit_id": "abc123def456",
"access_token": "ghp_xxxxxxxxxxxx",
"service": "github"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
repo: 'owner/repository',
commit_id: 'abc123def456',
access_token: 'ghp_xxxxxxxxxxxx',
service: 'github'
})
};
fetch('https://api.codeant.ai/api/analysis/results/antipatterns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.codeant.ai/api/analysis/results/antipatterns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'repo' => 'owner/repository',
'commit_id' => 'abc123def456',
'access_token' => 'ghp_xxxxxxxxxxxx',
'service' => 'github'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.codeant.ai/api/analysis/results/antipatterns"
payload := strings.NewReader("{\n \"repo\": \"owner/repository\",\n \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.codeant.ai/api/analysis/results/antipatterns")
.header("Content-Type", "application/json")
.body("{\n \"repo\": \"owner/repository\",\n \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.codeant.ai/api/analysis/results/antipatterns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"repo\": \"owner/repository\",\n \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\n}"
response = http.request(request)
puts response.read_body{
"results": {
"owner/repository/abc123def456/src/utils.py/anti_patterns.json": [
{
"line_number": 42,
"endLine": null,
"issue_text": "TODO: Implement timeout for requests",
"type": "CODE_SMELL",
"message-id": "W0511",
"fixAvailable": false,
"symbol": "fixme",
"column": 9,
"endColumn": null,
"severity": "Minor",
"context_code_block": "def fetch_data(url):\n headers = {\"Authorization\": f\"Bearer {token}\"}\n # TODO: Implement timeout for requests\n response = requests.get(url, headers=headers)\n if response.status_code == 200:\n return response.json()\n return None"
}
]
}
}{
"error": "Access token invalid"
}{
"error": "Error retrieving anti-patterns results"
}Get Anti-patterns Results
Retrieves the code anti-patterns and code smell detection results for a specific repository and commit
curl --request POST \
--url https://api.codeant.ai/api/analysis/results/antipatterns \
--header 'Content-Type: application/json' \
--data '
{
"repo": "owner/repository",
"commit_id": "abc123def456",
"access_token": "ghp_xxxxxxxxxxxx",
"service": "github"
}
'import requests
url = "https://api.codeant.ai/api/analysis/results/antipatterns"
payload = {
"repo": "owner/repository",
"commit_id": "abc123def456",
"access_token": "ghp_xxxxxxxxxxxx",
"service": "github"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
repo: 'owner/repository',
commit_id: 'abc123def456',
access_token: 'ghp_xxxxxxxxxxxx',
service: 'github'
})
};
fetch('https://api.codeant.ai/api/analysis/results/antipatterns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.codeant.ai/api/analysis/results/antipatterns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'repo' => 'owner/repository',
'commit_id' => 'abc123def456',
'access_token' => 'ghp_xxxxxxxxxxxx',
'service' => 'github'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.codeant.ai/api/analysis/results/antipatterns"
payload := strings.NewReader("{\n \"repo\": \"owner/repository\",\n \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.codeant.ai/api/analysis/results/antipatterns")
.header("Content-Type", "application/json")
.body("{\n \"repo\": \"owner/repository\",\n \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.codeant.ai/api/analysis/results/antipatterns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"repo\": \"owner/repository\",\n \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\n}"
response = http.request(request)
puts response.read_body{
"results": {
"owner/repository/abc123def456/src/utils.py/anti_patterns.json": [
{
"line_number": 42,
"endLine": null,
"issue_text": "TODO: Implement timeout for requests",
"type": "CODE_SMELL",
"message-id": "W0511",
"fixAvailable": false,
"symbol": "fixme",
"column": 9,
"endColumn": null,
"severity": "Minor",
"context_code_block": "def fetch_data(url):\n headers = {\"Authorization\": f\"Bearer {token}\"}\n # TODO: Implement timeout for requests\n response = requests.get(url, headers=headers)\n if response.status_code == 200:\n return response.json()\n return None"
}
]
}
}{
"error": "Access token invalid"
}{
"error": "Error retrieving anti-patterns results"
}Body
Repository identifier (format varies by service)
"owner/repository"
Authentication token for the service
"ghp_xxxxxxxxxxxx"
Version control service provider
github, azuredevops, gitlab, bitbucket "github"
Git commit SHA or identifier. Either commit_id or branch is required. If both are provided, commit_id takes precedence.
"abc123def456"
Git branch name. When provided without commit_id, the service resolves the latest commit from scan history for this branch. Either commit_id or branch is required.
"main"
Base URL for the service (optional for GitHub, required for GitLab)
"https://gitlab.com"
Response
Anti-patterns results retrieved successfully
Anti-patterns response containing detected code smells and anti-patterns
Anti-patterns analysis results organized by file path
Show child attributes
Show child attributes
{
"owner/repository/abc123def456/src/utils.py/anti_patterns.json": [
{
"line_number": 42,
"endLine": null,
"issue_text": "TODO: Implement timeout for requests",
"type": "CODE_SMELL",
"message-id": "W0511",
"fixAvailable": false,
"symbol": "fixme",
"column": 9,
"endColumn": null,
"severity": "Minor",
"context_code_block": "def fetch_data(url):\n headers = {\"Authorization\": f\"Bearer {token}\"}\n # TODO: Implement timeout for requests\n response = requests.get(url, headers=headers)\n if response.status_code == 200:\n return response.json()\n return None"
}
]
}