Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

New User: Need help with repository vulnerability alerts

Solved! Go to Solution.

I started using both the GitHub API and GraphQL today, so my apoligies if this is a reuimentary question. 

 

Currently I am trying to write a qurey that requests a specific repository and checks to see if there are any vulnerability alerts. 

 

Thus far I have managed to create the following, however it returns 

 

 "message": "Could not resolve to a Repository with the name 'test_sec_alerts'."

 

Here is what I have thus far: 

query{
  repository(owner:"Naughton", name:"test_sec_alerts") {
    vulnerabilityAlerts(first:10) {
      nodes {
        id
      }
    }
  }
}

 

I am including the Authorization and Accept application/vnd.github.vixen-preview+jso... headers. 

 

The only validation test I have at the moment is that when I run 

query {
  viewer {
    login
  }
}

My user name is being returned. 

 

I am sure there is something that I am doing wrong, however being new to this I do not know where to start debuggin. 

 

Thank you. 

1 Reply
Solution
Copilot Lvl 2
Message 2 of 2

Re: New User: Need help with repository vulnerability alerts

This was ultimetly a typo on my part with the repository name. 

Sending the following query will work: 

 

query{
  repository(owner:"Naughtron", name:"test_sec_alerts") {
    vulnerabilityAlerts(first:10) {
      nodes {
        id
      }
    }
  }
}

 

 

The Response will then be: 

028:RepositoryVulnerabilityAlert136876008
{
  "data": {
    "repository": {
      "vulnerabilityAlerts": {
        "nodes": [
          {
            "id": "MDI4OlJlcG9zaXRvcnlWdWxuZXJhYmlsaXR5QWxlcnQxMzY4NzYwMDg="
          }
        ]
      }
    }
  }
}

 

 

The id is base64 encoded, and turns into 

028:RepositoryVulnerabilityAlert136876008