### repositories.get() Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Gets a list of information about the tracked repositories. Deprecated. ```APIDOC ## GET /repositories ### Description Gets a list of information about the tracked repositories. Deprecated. ### Method GET ### Endpoint `/repositories` ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.repositories.get()) ``` ### Response #### Success Response (200) - **repositories** (list) - A list of repository objects. - **name** (str) - The name of the repository. - **url** (str) - The URL of the repository. #### Response Example ```json { "repositories": [ { "name": "my-repo", "url": "https://github.com/user/my-repo" } ] } ``` ``` -------------------------------- ### Socket Basics Get Configuration Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves the configuration for a given organization, with an option to get typed response objects. ```APIDOC ## GET /config ### Description Retrieves the configuration for a given organization, with an option to get typed response objects. ### Method GET ### Endpoint /config ### Parameters #### Query Parameters - **org_slug** (str) - Required - The organization name - **use_types** (bool) - Optional - Whether to return typed response objects (default: False) ### Response #### Success Response (200) - **config** (object) - Contains configuration details like javascriptSastEnabled and trivyImageEnabled. - **success** (bool) - Indicates if the request was successful. ### Response Example ```json { "success": true, "config": { "javascriptSastEnabled": true, "trivyImageEnabled": false } } ``` ``` -------------------------------- ### Get Supported Manifest Files via Python SDK Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieve a list of supported manifest file types for an organization to understand which dependency files are processed by Socket. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.supportedfiles.get("org_slug")) ``` -------------------------------- ### Get Socket Basics Configuration Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves the CI/CD security configuration for an organization, including settings for SAST, secret detection, and dependency analysis. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # Basic usage - returns dictionary config = socket.basics.get_config("org_slug") print(f"Python SAST enabled: {config['pythonSastEnabled']}") print(f"Secret scanning enabled: {config['secretScanningEnabled']}") # Using typed response objects from socketdev.basics import SocketBasicsConfig, SocketBasicsResponse ``` -------------------------------- ### GET /diffscans Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Lists all diff scans for an organization. ```APIDOC ## GET /diffscans ### Description List all diff scans for an organization. ### Method GET ### Endpoint /diffscans ### Parameters #### Query Parameters - **org_slug** (str) - Required - The organization name - **params** (dict) - Optional - Pagination or filtering parameters ### Response #### Success Response (200) - **scans** (array) - List of diff scan objects #### Response Example { "scans": [] } ``` -------------------------------- ### Retrieve Supported Report Types (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Gets a list of supported manifest file types that can be used for creating reports. This function does not require any parameters. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.report.supported()) ``` -------------------------------- ### GET /historical/list Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Lists historical alerts for an organization with optional filtering. ```APIDOC ## GET /historical ### Description List historical alerts for an organization. ### Method GET ### Endpoint /historical ### Parameters #### Query Parameters - **org_slug** (str) - Required - The organization name - **query_params** (dict) - Optional - Filtering parameters like repo name ### Response #### Success Response (200) - **alerts** (array) - List of historical alert objects #### Response Example { "alerts": [] } ``` -------------------------------- ### Get Telemetry Configuration (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves the telemetry configuration for an organization. Requires the organization slug. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.telemetry.get_config("org_slug")) ``` -------------------------------- ### Get Tracked Repositories (Deprecated) (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves a list of information about all repositories currently being tracked by Socket. Note: This function is deprecated. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.repositories.get()) ``` -------------------------------- ### Get Alert Types Metadata (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Fetches metadata for alert types. You can retrieve metadata for specific alert types by providing a list, or get all available alert types by omitting the list. Supports language localization. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # Get metadata for specific alert types alert_list = ["supply_chain_risk", "license_risk"] print(socket.alerttypes.get(alert_list, language="en-US")) # Get all alert types metadata print(socket.alerttypes.get()) ``` -------------------------------- ### Get GFM Diff via Socket SDK Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Generates a GitHub Flavored Markdown (GFM) representation of the differences between two full scans. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.fullscans.gfm("org_slug", "before_scan_id", "after_scan_id")) ``` -------------------------------- ### GET /labels/{label_id} Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves details of a specific label by its unique identifier. ```APIDOC ## GET /labels/{label_id} ### Description Retrieve a single label by its ID. ### Method GET ### Endpoint /labels/{label_id} ### Parameters #### Path Parameters - **org_slug** (str) - Required - The organization name - **label_id** (str) - Required - The label ID ### Response #### Success Response (200) - **label** (object) - The label details #### Response Example { "id": "label_123", "name": "security-critical" } ``` -------------------------------- ### Get Specific Webhook Details (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves detailed information for a specific webhook within an organization. Requires the organization slug and the unique webhook ID. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.webhooks.get("org_slug", "webhook_id")) ``` -------------------------------- ### Get NPM Package Issues (Deprecated) (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves the issues associated with a specific NPM package and version. Requires package name and version as input. Note: This function is deprecated. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.npm.issues("hardhat-gas-report", "1.1.25")) ``` -------------------------------- ### Get Organization Analytics - Python Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves organization analytics data. Note: This method is deprecated and the Historical module should be used instead. Requires the socketdev library and an authentication token. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") ``` -------------------------------- ### Get GitHub Flavored Markdown for Diff Scan - Python Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves GitHub Flavored Markdown (GFM) comments for a given diff scan. Requires the socketdev library, an authentication token, organization slug, and diff scan ID. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.diffscans.gfm("org_slug", "diff_scan_id")) ``` -------------------------------- ### Get Diff Scan by ID - Python Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves a specific diff scan using its organization slug and diff scan ID. Requires the socketdev library and an authentication token. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.diffscans.get("org_slug", "diff_scan_id")) ``` -------------------------------- ### Get NPM Package Score (Deprecated) (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves the score associated with a specific NPM package and version. Requires package name and version as input. Note: This function is deprecated. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.npm.score("hardhat-gas-report", "1.1.25")) ``` -------------------------------- ### Get Threat Feed Items - Python Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves threat feed items, either for a specific organization or globally (deprecated). Requires the socketdev library and an authentication token. Supports query parameters like per_page and sort. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # Get org-specific threat feed print(socket.threatfeed.get("org_slug", per_page=50, sort="created_at")) # Get global threat feed (deprecated) print(socket.threatfeed.get()) ``` -------------------------------- ### Get Audit Log Entries - Python Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves audit log entries for a specific organization. Requires the socketdev library, an authentication token, organization slug, and supports query parameters like limit and cursor. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.auditlog.get("org_slug", limit=100, cursor="abc123")) ``` -------------------------------- ### Get Organization Analytics (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves analytics data for an organization. Note: This method is deprecated and users should refer to socket.historical.list() or socket.historical.trend() instead. It requires an API token and accepts date filters. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # DEPRECATED: Use socket.historical.list() or socket.historical.trend() instead print(socket.analytics.get_org("alerts", start_date="2024-01-01")) ``` -------------------------------- ### Get Repository Analytics (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves analytics data for a specific repository. This function is deprecated; use the Historical module for current analytics. It requires a repository name, an analytics filter type, and optionally accepts date parameters. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # DEPRECATED: Use socket.historical.list() or socket.historical.trend() instead print(socket.analytics.get_repo("repo_name", "alerts", start_date="2024-01-01")) ``` -------------------------------- ### Create a full scan from manifest files Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Shows how to initiate a full scan by uploading a list of package manifest files and a FullScanParams configuration object. This method returns the full scan results including all SBOM artifacts. ```python from socketdev import socketdev from socketdev.fullscans import FullScanParams socket = socketdev(token="REPLACE_ME") files = [ "/path/to/manifest/package.json" ] params = FullScanParams( org_slug="org_name", repo="TestRepo", workspace="my-workspace", branch="main", commit_message="Test Commit Message", commit_hash="abc123def456", pull_request=123, committers=["committer1", "committer2"], make_default_branch=False, set_as_pending_head=False ) print(socket.fullscans.post(files, params)) ``` -------------------------------- ### Basics API Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Endpoints for retrieving Socket Basics configuration. ```APIDOC ## GET /basics/config ### Description Gets Socket Basics configuration for an organization. Socket Basics is a CI/CD security scanning suite that includes SAST scanning, secret detection, container security, and dependency analysis. ### Method GET ### Endpoint `/basics/config` ### Parameters #### Query Parameters - **org_slug** (str) - Required - The organization name. - **use_types** (bool) - Optional - Whether to return typed response objects. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # Basic usage - returns dictionary config = socket.basics.get_config("org_slug") print(f"Python SAST enabled: {config['pythonSastEnabled']}") print(f"Secret scanning enabled: {config['secretScanningEnabled']}") # Using typed response objects from socketdev.basics import SocketBasicsConfig, SocketBasicsResponse typed_config: SocketBasicsConfig = socket.basics.get_config("org_slug", use_types=True) print(f"Python SAST enabled: {typed_config.python_sast_enabled}") ``` ### Response #### Success Response (200) Returns the Socket Basics configuration for the organization. #### Response Example ```json { "pythonSastEnabled": true, "secretScanningEnabled": true, "containerScanningEnabled": false, "dependencyAnalysisEnabled": true } ``` ``` -------------------------------- ### Retrieve full scans with parameters Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Demonstrates how to fetch full scan data for a specific organization by providing an organization slug and a dictionary of query parameters for filtering results. ```python params = { "branch": "main", "limit": 10, "offset": 0 } print(socket.fullscans.get("org_slug", params)) ``` -------------------------------- ### settings.get() Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves the Socket Organization Settings. ```APIDOC ## GET /settings ### Description Retrieves the Socket Organization Settings. ### Method GET ### Endpoint `/settings` ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.settings.get()) ``` ### Response #### Success Response (200) - **default_branch(optional)** (str) - Name of the default branch for the repository. Defaults to `main`. #### Response Example ```json { "default_branch": "main" } ``` ``` -------------------------------- ### Manage Repositories using Python Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Allows for listing, creating, retrieving, and updating tracked repositories within the Socket platform. Each operation uses specific parameters to define repository metadata like visibility, branch settings, and descriptions. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # List repositories print(socket.repos.get(sort="name", direction="asc", per_page=100, page=1)) # Create repository print(socket.repos.post(name="example", description="Info about Repo", visibility='public')) # Get specific repository print(socket.repos.repo(org_slug="example", repo_name="example-repo")) # Update repository print(socket.repos.update(org_slug="example-org", repo_name="example", name="new-name")) ``` -------------------------------- ### Manage Dependencies using Python Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Provides methods to retrieve existing dependencies or import new ones by providing manifest file paths. These operations require an initialized Socket SDK instance with a valid API token. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # Retrieve dependencies print(socket.dependencies.get(10, 0)) # Import dependencies file_names = ["path/to/package.json"] params = {"repository": "username/repo-name", "branch": "dependency-branch"} print(socket.dependencies.post(file_names, params)) ``` -------------------------------- ### report.supported() Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves the supported types of manifest files for creating a report. ```APIDOC ## GET /report/supported ### Description Retrieves the supported types of manifest files for creating a report. ### Method GET ### Endpoint `/report/supported` ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.report.supported()) ``` ### Response #### Success Response (200) - **supported_files** (list) - A list of supported manifest file names. #### Response Example ```json { "supported_files": [ "package.json", "requirements.txt", "pom.xml" ] } ``` ``` -------------------------------- ### Dependencies API Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Endpoints for retrieving and analyzing dependencies. ```APIDOC ## GET /dependencies ### Description Retrieve the dependencies for the organization associated with the API Key. ### Method GET ### Endpoint /dependencies ### Parameters #### Query Parameters - **limit** (int) - Required - The maximum number of dependencies to return - **offset** (int) - Required - The index to start from for pulling the dependencies ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.dependencies.get(10, 0)) ``` ### Response #### Success Response (200) - **dependencies** (list) - A list of dependency objects. ### Response Example ```json [ { "name": "dependency-name", "version": "1.0.0" } ] ``` ``` ```APIDOC ## POST /dependencies ### Description Submit manifest files for dependency analysis. ### Method POST ### Endpoint /dependencies ### Parameters #### Request Body - **files** (list) - Required - The file paths of the manifest files to import into the Dependency API. - **params** (dict) - Optional - A dictionary of the `repository` and `branch` options for the API. - **repository** (str) - The repository name (e.g., "username/repo-name"). - **branch** (str) - The branch name. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") file_names = [ "path/to/package.json" ] params = { "repository": "username/repo-name", "branch": "dependency-branch" } print(socket.dependencies.post(file_names, params)) ``` ### Response #### Success Response (200) - **message** (str) - A success message indicating the files have been processed. ### Response Example ```json { "message": "Files processed successfully." } ``` ``` -------------------------------- ### Supported Files API Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Endpoint for retrieving a list of supported manifest file types for an organization. ```APIDOC ## GET /supportedfiles ### Description Retrieves a list of manifest file types that the Socket SDK supports for an organization. ### Method GET ### Endpoint `/supportedfiles` ### Parameters #### Path Parameters - **org_slug** (str) - Required - The organization slug. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.supportedfiles.get("org_slug")) ``` ### Response #### Success Response (200) - **supported_files** (list) - A list of supported file type strings. #### Response Example ```json { "supported_files": [ "package.json", "requirements.txt", "pom.xml" ] } ``` ``` -------------------------------- ### List Organization Webhooks (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Lists all webhooks configured for an organization. Requires the organization slug and can accept optional query parameters for filtering and pagination. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.webhooks.list("org_slug")) # With query parameters print(socket.webhooks.list("org_slug", limit=10, offset=0)) ``` -------------------------------- ### List Repository Labels (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Lists all repository labels for a given organization. Requires the organization slug as input. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.labels.list("org_slug")) ``` -------------------------------- ### Create Organization Webhook (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Creates a new webhook for an organization. Requires the organization slug and webhook configuration details such as URL and events to subscribe to. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") webhook_config = { "url": "https://example.com/webhook", "events": ["alert.created", "scan.completed"] } print(socket.webhooks.create("org_slug", **webhook_config)) ``` -------------------------------- ### Initialize Socket.dev Client Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Initializes the Socket.dev SDK client using an API token. This client serves as the base for all subsequent API interactions. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME", timeout=30) ``` -------------------------------- ### POST /labels Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Creates a new label within an organization. ```APIDOC ## POST /labels ### Description Creates a new label for the specified organization. ### Method POST ### Endpoint /labels ### Parameters #### Request Body - **org_slug** (str) - Required - The organization name - **label_name** (str) - Required - Name of the label to create ### Request Example { "org_slug": "my-org", "label_name": "security-critical" } ### Response #### Success Response (200) - **id** (str) - The ID of the created label #### Response Example { "id": "label_123" } ``` -------------------------------- ### Repositories API Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Endpoints for managing tracked repositories. ```APIDOC ## GET /repos ### Description Get a list of information about the tracked repositories. ### Method GET ### Endpoint /repos ### Parameters #### Query Parameters - **sort** (str) - Optional - The key to sort on from the repo properties. Defaults to `created_at`. - **direction** (str) - Optional - Can be `desc` or `asc`. Defaults to `desc`. - **per_page** (int) - Optional - Integer between 1 to 100. Defaults to `10`. - **page** (int) - Optional - Integer page number defaults to `1`. If there are no more results it will be `0`. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.repos.get(sort="name", direction="asc", per_page=100, page=1)) ``` ### Response #### Success Response (200) - **repositories** (list) - A list of repository objects. ### Response Example ```json [ { "name": "example-repo", "full_name": "user/example-repo" } ] ``` ``` ```APIDOC ## POST /repos ### Description Create a new Socket Repository. ### Method POST ### Endpoint /repos ### Parameters #### Request Body - **name** (str) - Required - The name of the Socket Repository. - **description** (str) - Optional - String description of the repository. - **homepage** (str) - Optional - URL of the homepage of the repository. - **visibility** (str) - Optional - Can be `public` or `private` and defaults to `private`. - **archived** (bool) - Optional - Boolean on if the repository is archived. Defaults to `False`. - **default_branch** (str) - Optional - String name of the default branch for the repository. Defaults to `main`. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print( socket.repos.post( name="example", description="Info about Repo", homepage="http://homepage", visibility='public', archived=False, default_branch='not-main' ) ) ``` ### Response #### Success Response (200) - **id** (int) - The unique identifier of the created repository. - **name** (str) - The name of the created repository. ### Response Example ```json { "id": 1, "name": "example" } ``` ``` ```APIDOC ## GET /repos/{org_slug}/{repo_name} ### Description Get information about a specific tracked repository. ### Method GET ### Endpoint /repos/{org_slug}/{repo_name} ### Parameters #### Path Parameters - **org_slug** (str) - Required - The organization slug. - **repo_name** (str) - Required - The name of the repository. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.repos.repo(org_slug="example", repo_name="example-repo")) ``` ### Response #### Success Response (200) - **name** (str) - The name of the repository. - **full_name** (str) - The full name of the repository (e.g., "user/repo-name"). ### Response Example ```json { "name": "example-repo", "full_name": "user/example-repo" } ``` ``` ```APIDOC ## PUT /repos/{org_slug}/{repo_name} ### Description Update an existing Socket Repository. ### Method PUT ### Endpoint /repos/{org_slug}/{repo_name} ### Parameters #### Path Parameters - **org_slug** (str) - Required - The organization slug. - **repo_name** (str) - Required - The name of the repository to update. #### Request Body - **name** (str) - Optional - The new name of the Socket Repository. - **description** (str) - Optional - String description of the repository. - **homepage** (str) - Optional - URL of the homepage of the repository. - **visibility** (str) - Optional - Can be `public` or `private` and defaults to `private`. - **archived** (bool) - Optional - Boolean on if the repository is archived. Defaults to `False`. - **default_branch** (str) - Optional - String name of the default branch for the repository. Defaults to `main`. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print( socket.repos.update( org_slug="example-org", repo_name="example", name="new-name-example", description="Info about Repo", homepage="http://homepage", visibility='public', archived=False, default_branch='not-main' ) ) ``` ### Response #### Success Response (200) - **message** (str) - A success message indicating the repository has been updated. ### Response Example ```json { "message": "Repository updated successfully." } ``` ``` -------------------------------- ### labels.post(org_slug, label_name) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Creates a new label in the organization. ```APIDOC ## POST /labels ### Description Creates a new label in the organization. ### Method POST ### Endpoint `/labels` ### Parameters #### Request Body - **org_slug** (str) - Required - The organization name. - **label_name** (str) - Required - The name of the label to create. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.labels.post(org_slug="example-org", label_name="feature")) ``` ### Response #### Success Response (200) - **message** (str) - Confirmation message of label creation. - **label** (object) - The created label object. - **id** (str) - The ID of the label. - **name** (str) - The name of the label. #### Response Example ```json { "message": "Label 'feature' created successfully.", "label": { "id": "label-2", "name": "feature" } } ``` ``` -------------------------------- ### labels.list(org_slug) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Lists all repository labels for the given organization. ```APIDOC ## GET /labels/{org_slug} ### Description Lists all repository labels for the given organization. ### Method GET ### Endpoint `/labels/{org_slug}` ### Parameters #### Path Parameters - **org_slug** (str) - Required - The organization name. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.labels.list("org_slug")) ``` ### Response #### Success Response (200) - **labels** (list) - A list of label objects. - **id** (str) - The ID of the label. - **name** (str) - The name of the label. #### Response Example ```json { "labels": [ { "id": "label-1", "name": "bug" } ] } ``` ``` -------------------------------- ### Manage Organization Labels with Socket SDK Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Provides methods to create, retrieve, delete, and associate labels with repositories. Also includes functionality to manage specific label settings. ```python print(socket.labels.post("org_slug", "my-label")) print(socket.labels.get("org_slug", "label_id")) print(socket.labels.delete("org_slug", "label_id")) print(socket.labels.associate("org_slug", 1234, "repo_id")) print(socket.labels.disassociate("org_slug", 1234, "repo_id")) print(socket.labels.setting.get("org_slug", 1234, "severity")) settings = {"severity": {"value": {"level": "high"}}} print(socket.labels.setting.put("org_slug", 1234, settings)) print(socket.labels.setting.delete("org_slug", 1234, "severity")) ``` -------------------------------- ### Retrieve Organization Settings (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Fetches the settings for the Socket Organization. This function does not require any parameters. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.settings.get()) ``` -------------------------------- ### report.create(files) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Creates a new project health report with the provided files. Deprecated. ```APIDOC ## POST /report/create ### Description Creates a new project health report with the provided files. Deprecated. ### Method POST ### Endpoint `/report/create` ### Parameters #### Request Body - **files** (list) - Required - List of file paths of manifest files. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") files = [ "/path/to/manifest/package.json" ] print(socket.report.create(files)) ``` ### Response #### Success Response (200) - **report_id** (str) - The ID of the newly created report. #### Response Example ```json { "report_id": "new-report-id" } ``` ``` -------------------------------- ### Search Full Scan Alerts via Python SDK Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Perform advanced searches across full security scans for an organization. Accepts query parameters to filter results by specific criteria like CVE identifiers. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") search_params = {"query": "CVE-2024-1234", "limit": 20} print(socket.alertfullscansearch.search("org_slug", **search_params)) ``` -------------------------------- ### npm.issues(package, version) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves the Issues associated with a package and version. Deprecated. ```APIDOC ## GET /npm/issues ### Description Retrieves the Issues associated with a package and version. Deprecated. ### Method GET ### Endpoint `/npm/issues` ### Query Parameters - **package** (str) - Required - The name of the NPM package. - **version** (str) - Required - The version of the NPM Package. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.npm.issues("hardhat-gas-report", "1.1.25")) ``` ### Response #### Success Response (200) - **issues** (list) - A list of issues found for the package and version. #### Response Example ```json { "issues": [ { "id": "issue-1", "severity": "high", "description": "Vulnerability found." } ] } ``` ``` -------------------------------- ### quota.get() Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves the current quota available for your API Key. ```APIDOC ## GET /quota ### Description Retrieves the current quota available for your API Key. ### Method GET ### Endpoint `/quota` ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.quota.get()) ``` ### Response #### Success Response (200) - **requests_remaining** (int) - The number of API requests remaining. - **requests_limit** (int) - The total number of API requests allowed. - **reports_remaining** (int) - The number of reports that can be created. - **reports_limit** (int) - The total number of reports allowed. #### Response Example ```json { "requests_remaining": 990, "requests_limit": 1000, "reports_remaining": 50, "reports_limit": 100 } ``` ``` -------------------------------- ### Retrieve Organization Configuration using Python Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Fetches the configuration settings for a specific organization, such as enabled SAST and scanning features. It returns a response object containing the configuration details if the request is successful. ```python response = socket.basics.get_config("org_slug", use_types=True) if response.success and response.config: print(f"JavaScript SAST: {response.config.javascriptSastEnabled}") print(f"Trivy scanning: {response.config.trivyImageEnabled}") ``` -------------------------------- ### Retrieve Security Alerts and Fixes via Python SDK Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Fetch security alerts and available dependency fixes for an organization. Supports optional filtering via query parameters such as severity or ecosystem. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # Get alerts print(socket.alerts.get("org_slug", severity="high", limit=50)) # Get fixes print(socket.fixes.get("org_slug", ecosystem="npm")) ``` -------------------------------- ### Full Scans API Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Endpoints for managing and retrieving full scan data. ```APIDOC ## DELETE /fullscans/{full_scan_id} ### Description Deletes an existing full scan. ### Method DELETE ### Endpoint `/fullscans/{full_scan_id}` ### Parameters #### Path Parameters - **org_slug** (str) - Required - The organization name. - **full_scan_id** (str) - Required - The ID of the full scan to delete. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") socket.fullscans.delete("org_slug", "full_scan_id") ``` ### Response #### Success Response (200) Indicates successful deletion. #### Response Example `true` (boolean) ``` ```APIDOC ## POST /fullscans/stream_diff ### Description Streams a diff between two full scans. Returns a scan diff. ### Method POST ### Endpoint `/fullscans/stream_diff` ### Parameters #### Query Parameters - **org_slug** (str) - Required - The organization name. - **before** (str) - Required - The base full scan ID. - **after** (str) - Required - The comparison full scan ID. - **use_types** (bool) - Optional - Whether to return typed response objects (default: True). - **include_license_details** (str) - Optional - Include license details ("true"/"false"). Can greatly increase response size. Defaults to "true". - **kwargs** - Additional query parameters. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # Basic usage print(socket.fullscans.stream_diff("org_slug", "before_scan_id", "after_scan_id")) # With additional parameters print(socket.fullscans.stream_diff( "org_slug", "before_scan_id", "after_scan_id", use_types=False, include_license_details="false" )) ``` ### Response #### Success Response (200) Returns a scan diff object. #### Response Example ```json { "diff": [ { "type": "added", "dependency": { "name": "new-package", "version": "1.0.0" } } ] } ``` ``` ```APIDOC ## GET /fullscans/stream/{full_scan_id} ### Description Streams all SBOM artifacts for a full scan. ### Method GET ### Endpoint `/fullscans/stream/{full_scan_id}` ### Parameters #### Path Parameters - **org_slug** (str) - Required - The organization name. - **full_scan_id** (str) - Required - The ID of the full scan. #### Query Parameters - **use_types** (bool) - Optional - Whether to return typed response objects (default: False). ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # Basic usage print(socket.fullscans.stream("org_slug", "full_scan_id")) # With typed response print(socket.fullscans.stream("org_slug", "full_scan_id", use_types=True)) ``` ### Response #### Success Response (200) Returns a stream of SBOM artifacts. #### Response Example ```json [ { "package": { "name": "example-package", "version": "1.2.3" }, "licenses": [ { "license_id": "MIT" } ] } ] ``` ``` ```APIDOC ## GET /fullscans/metadata/{full_scan_id} ### Description Gets metadata for a single full scan. ### Method GET ### Endpoint `/fullscans/metadata/{full_scan_id}` ### Parameters #### Path Parameters - **org_slug** (str) - Required - The organization name. - **full_scan_id** (str) - Required - The ID of the full scan. #### Query Parameters - **use_types** (bool) - Optional - Whether to return typed response objects (default: False). ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # Basic usage print(socket.fullscans.metadata("org_slug", "full_scan_id")) # With typed response print(socket.fullscans.metadata("org_slug", "full_scan_id", use_types=True)) ``` ### Response #### Success Response (200) Returns the metadata for the specified full scan. #### Response Example ```json { "id": "full_scan_id", "createdAt": "2023-10-27T10:00:00Z", "completedAt": "2023-10-27T10:05:00Z", "status": "completed" } ``` ``` ```APIDOC ## GET /fullscans/gfm ### Description Gets GitHub Flavored Markdown (GFM) diff between two full scans. ### Method GET ### Endpoint `/fullscans/gfm` ### Parameters #### Query Parameters - **org_slug** (str) - Required - The organization name. - **before** (str) - Required - The base full scan ID. - **after** (str) - Required - The comparison full scan ID. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.fullscans.gfm("org_slug", "before_scan_id", "after_scan_id")) ``` ### Response #### Success Response (200) Returns the GFM formatted diff. #### Response Example ```markdown ## Scan Diff ### Added - `new-package@1.0.0` ### Removed - `old-package@0.5.0` ``` ``` ```APIDOC ## POST /fullscans/finalize_tier1 ### Description Finalizes a tier 1 reachability scan by associating it with a full scan. ### Method POST ### Endpoint `/fullscans/finalize_tier1` ### Parameters #### Request Body - **full_scan_id** (str) - Required - The ID of the full scan to associate with the tier 1 scan. - **tier1_reachability_scan_id** (str) - Required - The tier 1 reachability scan ID from the facts file. ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") success = socket.fullscans.finalize_tier1("full_scan_id", "tier1_reachability_scan_id") print(f"Finalization successful: {success}") ``` ### Response #### Success Response (200) Indicates if the finalization was successful. #### Response Example `true` (boolean) ``` -------------------------------- ### Create Organization Label (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Creates a new label within the organization. Requires the organization slug and the desired label name as input. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.labels.post(org_slug="org_slug", label_name="new_label")) ``` -------------------------------- ### org.get() Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves the Socket.dev organization information. ```APIDOC ## GET /org ### Description Retrieves the Socket.dev organization information. ### Method GET ### Endpoint `/org` ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.org.get()) ``` ### Response #### Success Response (200) - **org_name** (str) - The name of the organization. - **org_slug** (str) - The slug of the organization. - **plan** (str) - The current subscription plan. #### Response Example ```json { "org_name": "My Organization", "org_slug": "my-org", "plan": "free" } ``` ``` -------------------------------- ### Manage Telemetry Configuration via Python SDK Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieve or update the telemetry settings for a specific organization. These methods require an organization slug and allow for granular configuration updates using keyword arguments. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # Get config print(socket.telemetry.get_config("org_slug")) # Update config config = {"enabled": True, "sampling_rate": 0.5} print(socket.telemetry.update_config("org_slug", **config)) ``` -------------------------------- ### Create Diff Scan from Repository Files - Python Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Creates a diff scan by analyzing specified files within a repository. Requires the socketdev library, an authentication token, organization slug, repository slug, a list of file paths, and optional parameters like branch and commit. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") files = ["/path/to/package.json"] params = {"branch": "main", "commit": "abc123"} print(socket.diffscans.create_from_repo("org_slug", "repo_slug", files, params)) ``` -------------------------------- ### Create Report (Deprecated) (Python) Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Creates a new project health report by providing a list of manifest file paths. Note: This function is deprecated. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") files = [ "/path/to/manifest/package.json" ] print(socket.report.create(files)) ``` -------------------------------- ### Manage Historical Data and Snapshots via Python SDK Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Access dependency trend data and manage historical snapshots for an organization. Allows for creating new snapshots and listing existing ones with pagination support. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") # Dependency trends query_params = {"from": "2024-01-01", "to": "2024-12-31"} print(socket.historical.dependencies_trend("org_slug", query_params)) # Snapshot management socket.historical.snapshots.create("org_slug") print(socket.historical.snapshots.list("org_slug", {"limit": 10})) ``` -------------------------------- ### Retrieve Package Information via PURL Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Retrieves package metadata and security scores for a list of package URLs. It accepts a license flag to toggle the inclusion of license information in the output. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") license = "true" components = [ {"purl": "pkg:pypi/pyonepassword@5.0.0"}, {"purl": "pkg:pypi/socketsecurity"} ] print(socket.purl.post(license, components)) ``` -------------------------------- ### Retrieve Full Scan Metadata via Socket SDK Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Fetches metadata for a single full scan. Supports optional typed response objects. ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.fullscans.metadata("org_slug", "full_scan_id")) # With typed response print(socket.fullscans.metadata("org_slug", "full_scan_id", use_types=True)) ``` -------------------------------- ### repos.delete() Source: https://github.com/socketdev/socket-sdk-python/blob/main/README.rst Deletes a Socket Repository. Requires organization slug and repository name. ```APIDOC ## DELETE /repos/{org_slug}/{repo_name} ### Description Deletes a Socket Repository. ### Method DELETE ### Endpoint `/repos/{org_slug}/{repo_name}` ### Parameters #### Path Parameters - **org_slug** (str) - Required - Name of the Socket Org - **repo_name** (str) - Required - The name of the Socket Repository to delete ### Request Example ```python from socketdev import socketdev socket = socketdev(token="REPLACE_ME") print(socket.repos.delete(org_slug="example", repo_name="example-repo")) ``` ### Response #### Success Response (200) - **message** (str) - Confirmation message of deletion. #### Response Example ```json { "message": "Repository 'example-repo' deleted successfully." } ``` ```