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

Enabling security alerts and dependecy graph through API

Hi all,

 

I'm trying to enable security alerts and dependency graph through the api, as a way to automate this so I don't have to do it repo by repo.

But not sure if I'm missing something, as I'm using this

curl -X PUT https://api.github.com/repos/MYUSER/NAMEOFTHEREPO/vulnerability-alerts

I do get a reponse

{
"message": "If you would like to help us test the Preview for repo vulnerability alert api endpoints during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.",
"documentation_url": "https://developer.github.com/v3/repos/#enable-vulnerability-alerts"
}

Which seems that the request was successfully, but when I log to the console, I see no changes.

 

Does anybody have faced this before?

Best regards

2 Replies
Highlighted
Ground Controller Lvl 1
Message 2 of 3

Re: Enabling security alerts and dependecy graph through API

Hi @Siedlarczyk,

 

You'll need to add a header to your CURL request. Please see the URL that was returned (https://developer.github.com/v3/repos/#enable-vulnerability-alerts) for more details.

 

 

curl -H "Accept: application/vnd.github.dorian-preview+json" -X PUT https://api.github.com/repos/MYUSER/NAMEOFTHEREPO/vulnerability-alerts

 

 

Alex

Highlighted
Ground Controller Lvl 2
Message 3 of 3

Re: Enabling security alerts and dependecy graph through API

Great!

 

Can I use this to get alerts to go to our 'security-champs' team?

 

Can I do this with all 400+ of our repositories?

 

Please tell me that it's possible; doing it manually is causing my mouse-hand to fall off!  :-)

 

Thanks (in advance!)