Post dependencies for analysis
https://api.datadoghq.com/api/v2/static-analysis-sca/dependencieshttps://api.us3.datadoghq.com/api/v2/static-analysis-sca/dependencieshttps://api.us5.datadoghq.com/api/v2/static-analysis-sca/dependencieshttps://api.datadoghq.eu/api/v2/static-analysis-sca/dependencieshttps://api.ap1.datadoghq.com/api/v2/static-analysis-sca/dependencieshttps://api.ap2.datadoghq.com/api/v2/static-analysis-sca/dependencieshttps://api.uk1.datadoghq.com/api/v2/static-analysis-sca/dependencieshttps://api.ddog-gov.com/api/v2/static-analysis-sca/dependencieshttps://api.us2.ddog-gov.com/api/v2/static-analysis-sca/dependenciesOverview
OAuth apps require the code_analysis_read authorization scope to access this endpoint.
Request
Body Data (required)
dataThe data object in an SCA request, containing the dependency graph attributes and request type.
attributesThe attributes of an SCA request, containing dependency graph data, vulnerability information, and repository context.
commitMetadata about the commit associated with the SCA scan, including author, committer, and branch information.
author_dateThe date when the commit was authored.
author_emailThe email address of the commit author.
author_nameThe full name of the commit author.
branchThe branch name on which the commit was made.
committer_emailThe email address of the person who committed the change.
committer_nameThe full name of the person who committed the change.
shaThe SHA hash uniquely identifying the commit.
dependenciesThe list of dependencies discovered in the repository.
exclusionsA list of patterns or identifiers that should be excluded from analysis for this dependency.
groupThe group or organization namespace of the dependency (e.g., Maven group ID).
is_devIndicates whether this is a development-only dependency not used in production.
is_directIndicates whether this is a direct dependency (as opposed to a transitive one).
languageThe programming language ecosystem of this dependency (e.g., java, python, javascript).
locationsThe list of source file locations where this dependency is declared.
blockA range within a file defined by a start and end position, along with the file name.
endA specific position (line and column) within a source file.
colThe column number of the position within the line.
lineThe line number of the position within the file.
file_nameThe name or path of the file containing this location.
roleThe semantic role associated with this file location.
startA specific position (line and column) within a source file.
colThe column number of the position within the line.
lineThe line number of the position within the file.
nameA nullable range within a file defined by a start and end position, along with the file name.
endA specific position (line and column) within a source file.
colThe column number of the position within the line.
lineThe line number of the position within the file.
file_nameThe name or path of the file containing this location.
roleThe semantic role associated with this file location.
startA specific position (line and column) within a source file.
colThe column number of the position within the line.
lineThe line number of the position within the file.
namespaceA nullable range within a file defined by a start and end position, along with the file name.
endA specific position (line and column) within a source file.
colThe column number of the position within the line.
lineThe line number of the position within the file.
file_nameThe name or path of the file containing this location.
roleThe semantic role associated with this file location.
startA specific position (line and column) within a source file.
colThe column number of the position within the line.
lineThe line number of the position within the file.
versionA nullable range within a file defined by a start and end position, along with the file name.
endA specific position (line and column) within a source file.
colThe column number of the position within the line.
lineThe line number of the position within the file.
file_nameThe name or path of the file containing this location.
roleThe semantic role associated with this file location.
startA specific position (line and column) within a source file.
colThe column number of the position within the line.
lineThe line number of the position within the file.
nameThe name of the dependency package.
opaqueIndicates whether dependency details are intentionally opaque.
package_managerThe package manager responsible for this dependency (e.g., maven, pip, npm).
purlThe Package URL (PURL) uniquely identifying this dependency.
reachable_symbol_propertiesProperties describing symbols from this dependency that are reachable in the application code.
nameThe name of the reachable symbol property.
valueThe value of the reachable symbol property.
requires_transitive_enrichmentIndicates whether this dependency requires transitive dependency enrichment.
target_frameworksThe target framework identifiers associated with this dependency.
versionThe version of the dependency.
version_constraintIndicates whether the version value represents a version constraint.
version_rangeThe version range associated with this dependency when a manifest declares a range.
envThe environment context in which the SCA scan was performed (e.g., production, staging).
filesThe list of dependency manifest files found in the repository.
nameThe name or path of the file within the repository.
purlThe Package URL (PURL) associated with the dependency declared in this file.
relationsThe dependency relations describing the inter-component dependency graph.
depends_onThe list of BOM references that this component directly depends on.
refThe BOM reference of the component that has dependencies.
repositoryInformation about the source code repository being analyzed.
urlThe URL of the repository.
scan_start_timestampThe time when the SCA scan started.
nanosNon-negative fractions of a second at nanosecond resolution.
secondsSeconds of UTC time since Unix epoch.
serviceThe name of the service or application being analyzed.
tagsA map of tags providing additional metadata for the SCA scan.
toolTool metadata included in SCA tags.
generatorMetadata about the tool that generated the SCA tags.
nameThe name of the tag generator.
versionThe version of the tag generator.
vulnerabilitiesThe list of vulnerabilities identified in the dependency graph.
affectsThe list of components affected by this vulnerability.
refThe BOM reference identifying the affected component.
bom_refThe unique BOM reference identifier for this vulnerability entry.
idThe vulnerability identifier (e.g., CVE ID or similar).
idAn optional identifier for this SCA request data object.
type [required]The type identifier for SCA dependency analysis requests.
scarequestsscarequests{
"data": {
"attributes": {
"commit": {
"author_date": "string",
"author_email": "string",
"author_name": "string",
"branch": "string",
"committer_email": "string",
"committer_name": "string",
"sha": "string"
},
"dependencies": [
{
"exclusions": [],
"group": "string",
"is_dev": false,
"is_direct": false,
"language": "string",
"locations": [
{
"block": {
"end": {
"col": "integer",
"line": "integer"
},
"file_name": "string",
"role": "string",
"start": {
"col": "integer",
"line": "integer"
}
},
"name": {
"end": {
"col": "integer",
"line": "integer"
},
"file_name": "string",
"role": "string",
"start": {
"col": "integer",
"line": "integer"
}
},
"namespace": {
"end": {
"col": "integer",
"line": "integer"
},
"file_name": "string",
"role": "string",
"start": {
"col": "integer",
"line": "integer"
}
},
"version": {
"end": {
"col": "integer",
"line": "integer"
},
"file_name": "string",
"role": "string",
"start": {
"col": "integer",
"line": "integer"
}
}
}
],
"name": "string",
"opaque": false,
"package_manager": "string",
"purl": "string",
"reachable_symbol_properties": [
{
"name": "string",
"value": "string"
}
],
"requires_transitive_enrichment": false,
"target_frameworks": [],
"version": "string",
"version_constraint": false,
"version_range": "string"
}
],
"env": "string",
"files": [
{
"name": "string",
"purl": "string"
}
],
"relations": [
{
"depends_on": [],
"ref": "string"
}
],
"repository": {
"url": "string"
},
"scan_start_timestamp": {
"nanos": "integer",
"seconds": "integer"
},
"service": "string",
"tags": {
"tool": {
"generator": {
"name": "string",
"version": "string"
}
}
},
"vulnerabilities": [
{
"affects": [
{
"ref": "string"
}
],
"bom_ref": "string",
"id": "string"
}
]
},
"id": "string",
"type": "scarequests"
}
}Response
OK
Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Code Example
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/static-analysis-sca/dependencies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "scarequests"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/static-analysis-sca/dependencies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "scarequests"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/static-analysis-sca/dependencies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "scarequests"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/static-analysis-sca/dependencies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "scarequests"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/static-analysis-sca/dependencies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "scarequests"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/static-analysis-sca/dependencies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "scarequests"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/static-analysis-sca/dependencies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "scarequests"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/static-analysis-sca/dependencies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "scarequests"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/static-analysis-sca/dependencies" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "scarequests"
}
}
EOF// Post dependencies for analysis returns "OK" response
package main
import (
"context"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
body := datadogV2.ScaRequest{
Data: &datadogV2.ScaRequestData{
Attributes: &datadogV2.ScaRequestDataAttributes{
Commit: &datadogV2.ScaRequestDataAttributesCommit{},
Dependencies: []datadogV2.ScaRequestDataAttributesDependenciesItems{
{
Exclusions: []string{},
Group: *datadog.NewNullableString(nil),
IsDirect: *datadog.NewNullableBool(nil),
Locations: []datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItems{
{
Block: &datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsFilePosition{
End: &datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition{},
Start: &datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition{},
},
Name: *datadogV2.NewNullableScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition(&datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition{
End: &datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition{},
Start: &datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition{},
}),
Namespace: *datadogV2.NewNullableScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition(&datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition{
End: &datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition{},
Start: &datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition{},
}),
Version: *datadogV2.NewNullableScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition(&datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition{
End: &datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition{},
Start: &datadogV2.ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition{},
}),
},
},
ReachableSymbolProperties: []datadogV2.ScaRequestDataAttributesDependenciesItemsReachableSymbolPropertiesItems{
{},
},
TargetFrameworks: []string{},
Version: *datadog.NewNullableString(nil),
},
},
Files: []datadogV2.ScaRequestDataAttributesFilesItems{
{},
},
Relations: []datadogV2.ScaRequestDataAttributesRelationsItems{
{
DependsOn: []string{},
},
},
Repository: &datadogV2.ScaRequestDataAttributesRepository{},
ScanStartTimestamp: *datadogV2.NewNullableScaRequestDataAttributesScanStartTimestamp(&datadogV2.ScaRequestDataAttributesScanStartTimestamp{}),
Tags: &datadogV2.ScaRequestDataAttributesTags{
Tool: &datadogV2.ScaRequestDataAttributesTagsTool{
Generator: &datadogV2.ScaRequestDataAttributesTagsToolGenerator{},
},
},
Vulnerabilities: []datadogV2.ScaRequestDataAttributesVulnerabilitiesItems{
{
Affects: []datadogV2.ScaRequestDataAttributesVulnerabilitiesItemsAffectsItems{
{},
},
},
},
},
Type: datadogV2.SCAREQUESTDATATYPE_SCAREQUESTS,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("v2.CreateSCAResult", true)
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewStaticAnalysisApi(apiClient)
r, err := api.CreateSCAResult(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `StaticAnalysisApi.CreateSCAResult`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// Post dependencies for analysis returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.StaticAnalysisApi;
import com.datadog.api.client.v2.model.ScaRequest;
import com.datadog.api.client.v2.model.ScaRequestData;
import com.datadog.api.client.v2.model.ScaRequestDataAttributes;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesCommit;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesDependenciesItems;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesDependenciesItemsLocationsItems;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesDependenciesItemsLocationsItemsFilePosition;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesDependenciesItemsReachableSymbolPropertiesItems;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesFilesItems;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesRelationsItems;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesRepository;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesScanStartTimestamp;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesTags;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesTagsTool;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesTagsToolGenerator;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesVulnerabilitiesItems;
import com.datadog.api.client.v2.model.ScaRequestDataAttributesVulnerabilitiesItemsAffectsItems;
import com.datadog.api.client.v2.model.ScaRequestDataType;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.createSCAResult", true);
StaticAnalysisApi apiInstance = new StaticAnalysisApi(defaultClient);
ScaRequest body =
new ScaRequest()
.data(
new ScaRequestData()
.attributes(
new ScaRequestDataAttributes()
.commit(new ScaRequestDataAttributesCommit())
.dependencies(
Collections.singletonList(
new ScaRequestDataAttributesDependenciesItems()
.group(null)
.isDirect(null)
.locations(
Collections.singletonList(
new ScaRequestDataAttributesDependenciesItemsLocationsItems()
.block(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsFilePosition()
.end(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition())
.start(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition()))
.name(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition()
.end(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition())
.start(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition()))
.namespace(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition()
.end(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition())
.start(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition()))
.version(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition()
.end(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition())
.start(
new ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition()))))
.reachableSymbolProperties(
Collections.singletonList(
new ScaRequestDataAttributesDependenciesItemsReachableSymbolPropertiesItems()))
.version(null)))
.files(
Collections.singletonList(new ScaRequestDataAttributesFilesItems()))
.relations(
Collections.singletonList(
new ScaRequestDataAttributesRelationsItems()))
.repository(new ScaRequestDataAttributesRepository())
.scanStartTimestamp(new ScaRequestDataAttributesScanStartTimestamp())
.tags(
new ScaRequestDataAttributesTags()
.tool(
new ScaRequestDataAttributesTagsTool()
.generator(
new ScaRequestDataAttributesTagsToolGenerator())))
.vulnerabilities(
Collections.singletonList(
new ScaRequestDataAttributesVulnerabilitiesItems()
.affects(
Collections.singletonList(
new ScaRequestDataAttributesVulnerabilitiesItemsAffectsItems())))))
.type(ScaRequestDataType.SCAREQUESTS));
try {
apiInstance.createSCAResult(body);
} catch (ApiException e) {
System.err.println("Exception when calling StaticAnalysisApi#createSCAResult");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Post dependencies for analysis returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi
from datadog_api_client.v2.model.sca_request import ScaRequest
from datadog_api_client.v2.model.sca_request_data import ScaRequestData
from datadog_api_client.v2.model.sca_request_data_attributes import ScaRequestDataAttributes
from datadog_api_client.v2.model.sca_request_data_attributes_commit import ScaRequestDataAttributesCommit
from datadog_api_client.v2.model.sca_request_data_attributes_dependencies_items import (
ScaRequestDataAttributesDependenciesItems,
)
from datadog_api_client.v2.model.sca_request_data_attributes_dependencies_items_locations_items import (
ScaRequestDataAttributesDependenciesItemsLocationsItems,
)
from datadog_api_client.v2.model.sca_request_data_attributes_dependencies_items_locations_items_file_position import (
ScaRequestDataAttributesDependenciesItemsLocationsItemsFilePosition,
)
from datadog_api_client.v2.model.sca_request_data_attributes_dependencies_items_locations_items_nullable_file_position import (
ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition,
)
from datadog_api_client.v2.model.sca_request_data_attributes_dependencies_items_locations_items_position import (
ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition,
)
from datadog_api_client.v2.model.sca_request_data_attributes_dependencies_items_reachable_symbol_properties_items import (
ScaRequestDataAttributesDependenciesItemsReachableSymbolPropertiesItems,
)
from datadog_api_client.v2.model.sca_request_data_attributes_files_items import ScaRequestDataAttributesFilesItems
from datadog_api_client.v2.model.sca_request_data_attributes_relations_items import (
ScaRequestDataAttributesRelationsItems,
)
from datadog_api_client.v2.model.sca_request_data_attributes_repository import ScaRequestDataAttributesRepository
from datadog_api_client.v2.model.sca_request_data_attributes_scan_start_timestamp import (
ScaRequestDataAttributesScanStartTimestamp,
)
from datadog_api_client.v2.model.sca_request_data_attributes_tags import ScaRequestDataAttributesTags
from datadog_api_client.v2.model.sca_request_data_attributes_tags_tool import ScaRequestDataAttributesTagsTool
from datadog_api_client.v2.model.sca_request_data_attributes_tags_tool_generator import (
ScaRequestDataAttributesTagsToolGenerator,
)
from datadog_api_client.v2.model.sca_request_data_attributes_vulnerabilities_items import (
ScaRequestDataAttributesVulnerabilitiesItems,
)
from datadog_api_client.v2.model.sca_request_data_attributes_vulnerabilities_items_affects_items import (
ScaRequestDataAttributesVulnerabilitiesItemsAffectsItems,
)
from datadog_api_client.v2.model.sca_request_data_type import ScaRequestDataType
body = ScaRequest(
data=ScaRequestData(
attributes=ScaRequestDataAttributes(
commit=ScaRequestDataAttributesCommit(),
dependencies=[
ScaRequestDataAttributesDependenciesItems(
exclusions=[],
group=None,
is_direct=None,
locations=[
ScaRequestDataAttributesDependenciesItemsLocationsItems(
block=ScaRequestDataAttributesDependenciesItemsLocationsItemsFilePosition(
end=ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition(),
start=ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition(),
),
name=ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition(
end=ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition(),
start=ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition(),
),
namespace=ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition(
end=ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition(),
start=ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition(),
),
version=ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition(
end=ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition(),
start=ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition(),
),
),
],
reachable_symbol_properties=[
ScaRequestDataAttributesDependenciesItemsReachableSymbolPropertiesItems(),
],
target_frameworks=[],
version=None,
),
],
files=[
ScaRequestDataAttributesFilesItems(),
],
relations=[
ScaRequestDataAttributesRelationsItems(
depends_on=[],
),
],
repository=ScaRequestDataAttributesRepository(),
scan_start_timestamp=ScaRequestDataAttributesScanStartTimestamp(),
tags=ScaRequestDataAttributesTags(
tool=ScaRequestDataAttributesTagsTool(
generator=ScaRequestDataAttributesTagsToolGenerator(),
),
),
vulnerabilities=[
ScaRequestDataAttributesVulnerabilitiesItems(
affects=[
ScaRequestDataAttributesVulnerabilitiesItemsAffectsItems(),
],
),
],
),
type=ScaRequestDataType.SCAREQUESTS,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["create_sca_result"] = True
with ApiClient(configuration) as api_client:
api_instance = StaticAnalysisApi(api_client)
api_instance.create_sca_result(body=body)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Post dependencies for analysis returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
config.unstable_operations["v2.create_sca_result".to_sym] = true
end
api_instance = DatadogAPIClient::V2::StaticAnalysisAPI.new
body = DatadogAPIClient::V2::ScaRequest.new({
data: DatadogAPIClient::V2::ScaRequestData.new({
attributes: DatadogAPIClient::V2::ScaRequestDataAttributes.new({
commit: DatadogAPIClient::V2::ScaRequestDataAttributesCommit.new({}),
dependencies: [
DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItems.new({
exclusions: [],
group: nil,
is_direct: nil,
locations: [
DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItems.new({
block: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsFilePosition.new({
_end: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition.new({}),
start: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition.new({}),
}),
name: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition.new({
_end: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition.new({}),
start: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition.new({}),
}),
namespace: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition.new({
_end: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition.new({}),
start: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition.new({}),
}),
version: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition.new({
_end: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition.new({}),
start: DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition.new({}),
}),
}),
],
reachable_symbol_properties: [
DatadogAPIClient::V2::ScaRequestDataAttributesDependenciesItemsReachableSymbolPropertiesItems.new({}),
],
target_frameworks: [],
version: nil,
}),
],
files: [
DatadogAPIClient::V2::ScaRequestDataAttributesFilesItems.new({}),
],
relations: [
DatadogAPIClient::V2::ScaRequestDataAttributesRelationsItems.new({
depends_on: [],
}),
],
repository: DatadogAPIClient::V2::ScaRequestDataAttributesRepository.new({}),
scan_start_timestamp: DatadogAPIClient::V2::ScaRequestDataAttributesScanStartTimestamp.new({}),
tags: DatadogAPIClient::V2::ScaRequestDataAttributesTags.new({
tool: DatadogAPIClient::V2::ScaRequestDataAttributesTagsTool.new({
generator: DatadogAPIClient::V2::ScaRequestDataAttributesTagsToolGenerator.new({}),
}),
}),
vulnerabilities: [
DatadogAPIClient::V2::ScaRequestDataAttributesVulnerabilitiesItems.new({
affects: [
DatadogAPIClient::V2::ScaRequestDataAttributesVulnerabilitiesItemsAffectsItems.new({}),
],
}),
],
}),
type: DatadogAPIClient::V2::ScaRequestDataType::SCAREQUESTS,
}),
})
p api_instance.create_sca_result(body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Post dependencies for analysis returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_static_analysis::StaticAnalysisAPI;
use datadog_api_client::datadogV2::model::ScaRequest;
use datadog_api_client::datadogV2::model::ScaRequestData;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributes;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesCommit;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesDependenciesItems;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesDependenciesItemsLocationsItems;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesDependenciesItemsLocationsItemsFilePosition;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesDependenciesItemsReachableSymbolPropertiesItems;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesFilesItems;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesRelationsItems;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesRepository;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesScanStartTimestamp;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesTags;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesTagsTool;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesTagsToolGenerator;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesVulnerabilitiesItems;
use datadog_api_client::datadogV2::model::ScaRequestDataAttributesVulnerabilitiesItemsAffectsItems;
use datadog_api_client::datadogV2::model::ScaRequestDataType;
use std::collections::BTreeMap;
#[tokio::main]
async fn main() {
let body =
ScaRequest
::new().data(
ScaRequestData::new(
ScaRequestDataType::SCAREQUESTS,
).attributes(
ScaRequestDataAttributes::new()
.commit(ScaRequestDataAttributesCommit::new())
.dependencies(
vec![
ScaRequestDataAttributesDependenciesItems::new()
.exclusions(vec![])
.group(None)
.is_direct(None)
.locations(
Some(
vec![
ScaRequestDataAttributesDependenciesItemsLocationsItems::new()
.block(
ScaRequestDataAttributesDependenciesItemsLocationsItemsFilePosition
::new()
.end(
ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition
::new(),
)
.start(
ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition
::new(),
),
)
.name(
Some(
ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition
::new()
.end(
ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition
::new(),
)
.start(
ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition
::new(),
),
),
)
.namespace(
Some(
ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition
::new()
.end(
ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition
::new(),
)
.start(
ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition
::new(),
),
),
)
.version(
Some(
ScaRequestDataAttributesDependenciesItemsLocationsItemsNullableFilePosition
::new()
.end(
ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition
::new(),
)
.start(
ScaRequestDataAttributesDependenciesItemsLocationsItemsPosition
::new(),
),
),
)
],
),
)
.reachable_symbol_properties(
vec![
ScaRequestDataAttributesDependenciesItemsReachableSymbolPropertiesItems::new()
],
)
.target_frameworks(vec![])
.version(None)
],
)
.files(vec![ScaRequestDataAttributesFilesItems::new()])
.relations(vec![ScaRequestDataAttributesRelationsItems::new().depends_on(vec![])])
.repository(ScaRequestDataAttributesRepository::new())
.scan_start_timestamp(Some(ScaRequestDataAttributesScanStartTimestamp::new()))
.tags(
ScaRequestDataAttributesTags::new()
.tool(
ScaRequestDataAttributesTagsTool
::new().generator(ScaRequestDataAttributesTagsToolGenerator::new()),
)
.additional_properties(BTreeMap::from([])),
)
.vulnerabilities(
vec![
ScaRequestDataAttributesVulnerabilitiesItems
::new().affects(vec![ScaRequestDataAttributesVulnerabilitiesItemsAffectsItems::new()])
],
),
),
);
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.create_sca_result", true);
let api = StaticAnalysisAPI::with_config(configuration);
let resp = api.create_sca_result(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run/**
* Post dependencies for analysis returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
configuration.unstableOperations["v2.createSCAResult"] = true;
const apiInstance = new v2.StaticAnalysisApi(configuration);
const params: v2.StaticAnalysisApiCreateSCAResultRequest = {
body: {
data: {
attributes: {
commit: {},
dependencies: [
{
exclusions: [],
group: undefined,
isDirect: undefined,
locations: [
{
block: {
end: {},
start: {},
},
name: {
end: {},
start: {},
},
namespace: {
end: {},
start: {},
},
version: {
end: {},
start: {},
},
},
],
reachableSymbolProperties: [{}],
targetFrameworks: [],
version: undefined,
},
],
files: [{}],
relations: [
{
dependsOn: [],
},
],
repository: {},
scanStartTimestamp: {},
tags: {
tool: {
generator: {},
},
},
vulnerabilities: [
{
affects: [{}],
},
],
},
type: "scarequests",
},
},
};
apiInstance
.createSCAResult(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"