Skip to content

GraphQL API v4 - Accessing RepositoryVulnerabilityAlert #24413

Discussion options

You must be logged in to vote

Hey @sgript!

I see a few mistakes in your script, both in the GraphQL query you’re running, as well as in how you’re running it. 

The GraphQL Query that you want in order to list repository vulnerability alerts off of a single repo should look something like this:

query repoVulns($owner:String!, $name:String!){
  repository(owner:$owner, name:$name) {
    vulnerabilityAlerts(first:10) {
      nodes {
        id
      }
    }
  }
}

In addition, it looks like you’re passing the wrong data in with data=json.dumps(payload), which seems to be a variable that only has some headers in it. I went ahead and made the changes, and I think this shoud work:

import os
import requests
import json

url = '

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants