Get the statistics for the specified components
curl --request POST \
--url https://api.scanoss.com/v2/components/statistics \
--header 'Content-Type: application/json' \
--data '
{
"components": [
{
"purl": "pkg:github/scanoss/engine@1.0.0"
},
{
"purl": "pkg:github/scanoss/scanoss.py@v1.30.0"
}
]
}
'import requests
url = "https://api.scanoss.com/v2/components/statistics"
payload = { "components": [{ "purl": "pkg:github/scanoss/engine@1.0.0" }, { "purl": "pkg:github/scanoss/scanoss.py@v1.30.0" }] }
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({
components: [
{purl: 'pkg:github/scanoss/engine@1.0.0'},
{purl: 'pkg:github/scanoss/scanoss.py@v1.30.0'}
]
})
};
fetch('https://api.scanoss.com/v2/components/statistics', 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.scanoss.com/v2/components/statistics",
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([
'components' => [
[
'purl' => 'pkg:github/scanoss/engine@1.0.0'
],
[
'purl' => 'pkg:github/scanoss/scanoss.py@v1.30.0'
]
]
]),
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.scanoss.com/v2/components/statistics"
payload := strings.NewReader("{\n \"components\": [\n {\n \"purl\": \"pkg:github/scanoss/engine@1.0.0\"\n },\n {\n \"purl\": \"pkg:github/scanoss/scanoss.py@v1.30.0\"\n }\n ]\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.scanoss.com/v2/components/statistics")
.header("Content-Type", "application/json")
.body("{\n \"components\": [\n {\n \"purl\": \"pkg:github/scanoss/engine@1.0.0\"\n },\n {\n \"purl\": \"pkg:github/scanoss/scanoss.py@v1.30.0\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scanoss.com/v2/components/statistics")
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 \"components\": [\n {\n \"purl\": \"pkg:github/scanoss/engine@1.0.0\"\n },\n {\n \"purl\": \"pkg:github/scanoss/scanoss.py@v1.30.0\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"component_statistics": [
{
"purl": "pkg:github/scanoss/engine@5.0.0",
"version": "5.0.0",
"statistics": {
"total_source_files": 156,
"total_lines": 25430,
"total_blank_lines": 3420,
"languages": [
{
"name": "C",
"files": 89
},
{
"name": "C Header",
"files": 45
}
]
}
}
],
"status": {
"status": "SUCCESS",
"message": "Component statistics successfully retrieved"
}
}"<string>"{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Components
Get the statistics for the specified components
POST
/
v2
/
components
/
statistics
Get the statistics for the specified components
curl --request POST \
--url https://api.scanoss.com/v2/components/statistics \
--header 'Content-Type: application/json' \
--data '
{
"components": [
{
"purl": "pkg:github/scanoss/engine@1.0.0"
},
{
"purl": "pkg:github/scanoss/scanoss.py@v1.30.0"
}
]
}
'import requests
url = "https://api.scanoss.com/v2/components/statistics"
payload = { "components": [{ "purl": "pkg:github/scanoss/engine@1.0.0" }, { "purl": "pkg:github/scanoss/scanoss.py@v1.30.0" }] }
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({
components: [
{purl: 'pkg:github/scanoss/engine@1.0.0'},
{purl: 'pkg:github/scanoss/scanoss.py@v1.30.0'}
]
})
};
fetch('https://api.scanoss.com/v2/components/statistics', 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.scanoss.com/v2/components/statistics",
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([
'components' => [
[
'purl' => 'pkg:github/scanoss/engine@1.0.0'
],
[
'purl' => 'pkg:github/scanoss/scanoss.py@v1.30.0'
]
]
]),
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.scanoss.com/v2/components/statistics"
payload := strings.NewReader("{\n \"components\": [\n {\n \"purl\": \"pkg:github/scanoss/engine@1.0.0\"\n },\n {\n \"purl\": \"pkg:github/scanoss/scanoss.py@v1.30.0\"\n }\n ]\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.scanoss.com/v2/components/statistics")
.header("Content-Type", "application/json")
.body("{\n \"components\": [\n {\n \"purl\": \"pkg:github/scanoss/engine@1.0.0\"\n },\n {\n \"purl\": \"pkg:github/scanoss/scanoss.py@v1.30.0\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scanoss.com/v2/components/statistics")
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 \"components\": [\n {\n \"purl\": \"pkg:github/scanoss/engine@1.0.0\"\n },\n {\n \"purl\": \"pkg:github/scanoss/scanoss.py@v1.30.0\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"component_statistics": [
{
"purl": "pkg:github/scanoss/engine@5.0.0",
"version": "5.0.0",
"statistics": {
"total_source_files": 156,
"total_lines": 25430,
"total_blank_lines": 3420,
"languages": [
{
"name": "C",
"files": 89
},
{
"name": "C Header",
"files": 45
}
]
}
}
],
"status": {
"status": "SUCCESS",
"message": "Component statistics successfully retrieved"
}
}"<string>"{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Body
application/json
Represents a list of software component to be analyzed by SCANOSS API services. Allows analysis of multiple software components in a single API call, improving performance over individual requests.
Represents a list of software component to be analyzed by SCANOSS API services. Allows analysis of multiple software components in a single API call, improving performance over individual requests.
Show child attributes
Show child attributes
⌘I