Example queries

The ActiveState Build Graph provides programmatic access to detailed information about ActiveState Platform resources.

The following example queries use the ActiveState/ActivePython-3.8 project to demonstrate the capabilities of the API using Build Graph. This is a public project available on Windows and Linux. It includes a comprehensive list of popular packages for Python development, added and updated over time in a number of commits.

Query for project details and source code

{
  project(org: "ActiveState", name: "ActivePython-3.8") {
    __typename
    ... on Project {
      name
      description
      commit {
        commit_id
        sources(limit: 3) {
          name
          url
        }
      }
    }
    ... on NotFound {
      message
    }
  }
}

Open in GraphiQL

Response

{
  "data": {
    "project": {
      "__typename": "Project",
      "commit": {
        "commit_id": "70393b8c-7a03-4dab-9600-b5954c9c2d8b",
        "sources": [
          {
            "name": "python",
            "url": "https://dl.activestate.com/source/161a6a17-6b8a-54c9-a476-2c8c960b054e/versions/e99cca64-84a1-5ef8-9e31-27130917a1ad/revisions/2/Python-3.8.8.tgz"
          },
          {
            "name": "Arpeggio",
            "url": "https://dl.activestate.com/source/f0551e54-af67-536f-b940-b85cc3823b22/versions/2893f55e-8b9a-5dc0-b24a-5edbcd2b67b8/revisions/2/Arpeggio-1.10.1.tar.gz"
          },
          {
            "name": "Automat",
            "url": "https://dl.activestate.com/source/a5f3e778-e279-5fd0-a495-eb25df199672/versions/a3c45c71-e999-56b3-a0b1-44f271505b42/revisions/4/Automat-20.2.0.tar.gz"
          }
        ]
      },
      "description": "Final release of Community Python 3.8. Not maintained.",
      "name": "ActivePython-3.8"
    }
  }
}

Query for CVE Summary on a project

This query uses the ML-Mini-Runtime to demonstrate how to retrieve the vulnerability summary for a project.

{
# Query a project, fetching various fields of it and its commit,
# or showing the error message if it's not found.
project(org: "ActiveState", name: "ActivePython-3.8") {
__typename
... on Project {
name
description
commit {
commit_id
vulnerability_histogram {
severity
count
}
}
}
... on NotFound {
message
}
}
}

Open in GraphiQL

Response

{
  "data": {
    "project": {
      "__typename": "Project",
      "commit": {
        "commit_id": "1ca09276-2f1a-4ba2-8780-27e941d5fa9f",
        "vulnerability_histogram": [
          {
            "severity": "CRITICAL",
            "count": 41
          },
          {
            "severity": "HIGH",
            "count": 133
          },
          {
            "severity": "MEDIUM",
            "count": 142
          },
          {
            "severity": "MODERATE",
            "count": 142
          },
          {
            "severity": "LOW",
            "count": 6
          },
          {
            "severity": "UNKNOWN",
            "count": 1
          }
        ]
      },
      "description": "",
      "name": "ML-Mini-Runtime"
    }
  }
}