CodeCertify

Module List

Retrieve a list of modules associated with the given CodeCertify project. The returned projectId field may be used to query for SecureCore project details.

import requests

# Define the GraphQL endpoint URL
url = "https://app.threatrix.io/graphql"
apikey = "{THREATRIX_API_OR_SERVICE_KEY}" # Replace with your actual service key

# Example GraphQL query - adjust based on your needs
query = """
{
  entity(entityId: "{SCP_PROJECT_ID}", scp: true) {
    entityId
    parentEntityId
    name
    entityType
    removed
    entitySubType
    scpProjectMetrics
    projects(scp: true, filter: "", first: 100) {
      totalCount
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
      edges {
        node {
          projectId
          entityId
          name
          tags
          dependencyManagerType
          scpProject {
            scpProjectId
            scpProjectName
            scpProjectType
          }
          scpModuleMetrics(scpProjectId: "{SCP_PROJECT_ID}")
          latestScan {
            errorMsg
            branch
            status
            otMetaData
            orgId
            created
            version
            tag
            scanId
            log
            status
            versionHash
            vulnerabilityCount
            typeOfScan
            otAssetsCount
          }
        }
      }
    }
  }
}

"""

# Define the headers with the Bearer token for authentication
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer "+apikey,  
}

# Define the payload to send with the request
payload = {
    "query": query
}

# Make the request to the GraphQL endpoint
response = requests.post(url, json=payload, headers=headers)

# Check if the request was successful
if response.status_code == 200:
    # Print the response data
    print("Response data:", response.json())
else:
    print(f"Request failed with status code {response.status_code}")

Last updated