Get GitHub security alerts through notification API - github

I want to get GitHub notifications about a given repo’s Security alerts through the notification API, and I would like to know the JSON returned by this API.
Let say for a given repo I subscribed to the Release and Security alerts in GitHub UI:
When I publish a “Security advisory” on a given repo, I don’t receive any notification with the others account subscribed to this repo. I think this is because GitHub needs to validate this security advisory before it sends the notifications events.
So can someone please give me an example of JSON returned by the notification API for a Security event ?
Here is an example of JSON returned by the notification API for the Release events (as I can generate some by myself):
curl -su <me>:<token> https://api.github.com/notifications
[
{
"id": "3267365319",
"unread": false,
"reason": "subscribed",
"updated_at": "2022-03-14T16:07:41Z",
"last_read_at": null,
"subject": {
"title": "0.5.0",
"url": "https://api.github.com/repos/pfrayer/release-tester/releases/61780007",
"latest_comment_url": "https://api.github.com/repos/pfrayer/release-tester/releases/61780007",
"type": "Release"
},
"repository": {
...
I’m looking for the same kind of JSON, but for the Security events.

Related

Is it possible to set out user status message in teams through graph API?

I want to set user status message in teams using graph api and I saw this code but it's not working for me is there any solution that could help??
"#odata. context":"https://graph.mic.."
"id": "f599db41-7474-416a-acb1-88f9e
"availability": "Available"
"activity" :"Available"
"outofOfficeSettings": {"message": "oof mes"
"is0utofoffice":true }
Note: the availability & activity is working and has been updating in teams but the part below is not working for me""
or is there any way using graph api that I could set teams status message from bambooHR direct to teams?
You cannot set out of office user presence through graph API. As of now, only the parameters mentioned below are supported in the body of setPresence call
POST https://graph.microsoft.com/beta/users/object_id_of_user/presence/setPresence
Also, this call is supported under Application context only and not under user context.
sessionId
availability
activity
expirationDuration
However, you can view the out of office user presence via graph API by using below call:
GET https://graph.microsoft.com/beta/me/presence
or
GET https://graph.microsoft.com/beta/users/object_id_of_user/presence
{
"id": "fa8bf3dc-eca7-46b7-bad1-db199b62afc3",
"availability": "Available",
"activity": "Available",
"outOfOfficeSettings": {
"message": null,
"isOutOfOffice": false
}
}
Ref Doc:
https://learn.microsoft.com/en-us/graph/api/presence-get?view=graph-rest-beta&tabs=http
https://learn.microsoft.com/en-us/graph/api/presence-setpresence?view=graph-rest-beta&tabs=http
If you wish you may vote for this feature on Microsoft Teams · Community

Unable to get Azure DevOps events through REST API

I am trying to get Azure DevOps events through REST API listed below:
POST https://dev.azure.com/{organization}/_apis/notification/events?api-version=5.0-preview.1
I tried the above API to get events but in postman call, I am getting below response:
{
"$id": "1",
"innerException": null,
"message": "The feature is disabled. Contact your Azure DevOps Server administrator.",
"typeName": "Microsoft.TeamFoundation.Framework.Server.FeatureDisabledException, Microsoft.TeamFoundation.Framework.Server",
"typeKey": "FeatureDisabledException",
"errorCode": 0,
"eventId": 3000
}
It should give events after postman call
Your method with POST is for publish a new event: Events - Publish Event. I can not find the get method for events (only: Event Types - Get or Event Types - List). Maybe it was not coded yet:

Azure Devops Releases Pre-deployment comment edit

I have a lot of releases and there are pre-deployment approver. Approver writes comment before approve and I want to edit old comment. Is this possible ?
I do not think this is possible, either via the interface or via the API, the idea being that an approval for a release should be an immutable record of that event.
If you try and update an 'approved' approval via the REST API, you will get the relevant exception:
Request
PATCH https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/approvals/{approvalId}?api-version=5.0-preview.3
{
"status": "approved",
"comments": "Change comment"
}
Response
{
"$id": "1",
"innerException": null,
"message": "Approval(s) {approvalId} are not in a pending state. Only pending approval(s) can be updated. Please refresh the release and provide pending approvals.",
"typeName": "Microsoft.VisualStudio.Services.ReleaseManagement.Data.Exceptions.InvalidRequestException, Microsoft.VisualStudio.Services.ReleaseManagement2.Data",
"typeKey": "InvalidRequestException",
"errorCode": 0,
"eventId": 3000
}
If you have a situation whereby something offensive or inappropriate has been written into these comments in your organisation you could try to delete the release entirely or contact Azure DevOps support.

all_trips Webhooks: Find out which user the status_changed is for

I've got the Webhooks working for our developer accounts, and it emits a status_changed message every time there is an Uber request, even if the request was not initiated from our app (using the "all_trips" permission)
When we get the response back, how do we determine which user this is for? E.g. in the response below, there is no way to determine that and using the server token to authenticate to the resource_href gives an "Invalid OAuth 2.0 credentials provided" error.
{
"event_id": "3a3f3da4-14ac-4056-bbf2-d0b9cdcb0777",
"event_time": 1427343990,
"event_type": "all_trips.status_changed",
"meta": {
"resource_id": "2a2f3da4",
"resource_type": "request",
"status": "accepted"
},
"resource_href": "https://api.uber.com/v1/requests/2a2f3da4"
}
Thanks for catching this! We rolled out a fix that adds the users UUID as an additional field in the "meta" section, as well as updated our documentation here: https://developer.uber.com/docs/webhooks
Let us know if you have any more trouble!

setting event organizer with Outlook Calendar REST API

I am using the Outlook REST API for creating events and sending its invitations, based on this documentation
I authenticate the logged in user, and send its Bearer token through the Authorization header of the request, and the json-formatted event on its content.
If I set the "Organizer" to another user rather than the authenticated one, as well as the "IsOrganizer" property to "false", it gets totally ignored and sets the current logged in user as the organizer.
Any clues of what could be happening?
Is there another way of doing this?
Thank you!
I'm posting this in case someone else finds and needs an answer for this scenario...
You (Account A) can create a calendar event as someone else (Account B) through Office365 REST APIs as long as the account has permission to send as the other user account.
Here are the steps:
1) Call the Office365 REST API as follows,where {{{user2email}}} is the user you want the event to be created as (Account B's email address):
https://outlook.office365.com/api/v1.0/users/{{{user2email}}}/calendar
This should return Account B's user's calendar ID.
2) Pass in your JSON - the following is an example of what I used during unit testing:
{
"Subject": "Test - Created using Office365 Calendar REST API should be from Technology Notice",
"IsOrganizer": "False",
"Body": {
"ContentType": "HTML",
"Content": "This is where body copy goes HTML supported"
},
"Start": "2015-12-11T19:00:00Z",
"End": "2015-12-11T20:00:00Z",
"Attendees": [
{
"EmailAddress": {
"Address": "attendee1#yourcompany.com",
"Name": "Attendee One"
},
"Type": "Required"
}
],
"Organizer": {
"EmailAddress": {
"Address": "tnotice#yourcompany.com",
"Name": "Technology Notice"
}
}
}
'Technology Notice' will be who the calendar invite is from.
3) Use the ID from step 2 in your POST request, for example:
https://outlook.office365.com/api/v1.0/users/{{{user2email}}}/calendars/{{{ID}}}/events
Note: Make sure you're sending the POST request as the authenticated user account (Account A) who's account the mailbox/calendar it actually belongs to.
If everything is right you should be able to send a calendar invite and have it show up as originating from Account B instead of Account A.
Hope this helps someone out.
This is the correct behavior. You cannot create an event on User A's calendar but set the organizer to User B.