How to find users who approved a pull request using github api? - github

For example, given this pull request : https://github.com/harsh-groverfk/jenkins-demo/pull/16
How to find the list of users who have "approved" the changes in these pull requests.
this is an example review for this pull request : https://github.com/harsh-groverfk/jenkins-demo/pull/16#pullrequestreview-16967726

You can do this by using the List Reviews for a Pull Request API endpoint. For the example PR you've listed this would be:
GET /repos/harsh-groverfk/jenkins-demo/pulls/16/reviews
This will output all reviews done on a PR (example from the docs):
[
{
"id": 80,
"user": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"body": "Here is the body for the review.",
"commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091",
"state": "APPROVED",
"html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80",
"pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12",
"_links": {
"html": {
"href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80"
},
"pull_request": {
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/12"
}
}
}
]

Using the GraphQL API:
{
repository(name: "jenkins-demo", owner: "harsh-groverfk") {
pullRequest(number: 16) {
reviews(first: 100, states: APPROVED) {
nodes {
author {
avatarUrl
login
resourcePath
url
}
}
}
}
}
}
Response:
{
"data": {
"repository": {
"pullRequest": {
"reviews": {
"nodes": [
{
"author": {
"avatarUrl": "https://avatars.githubusercontent.com/u/24560176?v=4",
"login": "alekh2",
"resourcePath": "/alekh2",
"url": "https://github.com/alekh2"
}
}
]
}
}
}
}
}
If you don't have the specific pull request number, you can query the pullRequests field.

Related

Sabre BargainFinderMax REST API error for /offers/shop for southwest airlines (IATA code: WN)

We are trying to use BargainFinderMax REST API v3/offers/shop and /v4/offers/shop for southwest airlines (WN) but getting errors for the following requests in the CERT environment
We have tied both the old & new domain name endpoints (as per https://developer.sabre.com/guides/travel-agency/developer-guides/api-endpoints) but still throwing the error
New Endpoints:
https://api.cert.platform.sabre.com/v4/offers/shop
https://api.cert.platform.sabre.com/v3/offers/shop
Old Endpoints:
https://api-crt.cert.havail.sabre.com/v4/offers/shop
https://api-crt.cert.havail.sabre.com/v3/offers/shop
Request#1:
{
"OTA_AirLowFareSearchRQ": {
"MaxResponses": "10",
"OriginDestinationInformation": [{
"RPH": "1",
"DepartureDateTime": "2022-08-19T00:00:00",
"OriginLocation": {
"LocationCode": "SFO"
},
"DestinationLocation": {
"LocationCode": "LAX"
},
"TPA_Extensions": {
"SegmentType": {
"Code": "O"
}
}
}],
"POS": {
"Source": [{
"PseudoCityCode": "xxxx",
"RequestorID": {
"CompanyName": {
"Code": "TN"
},
"ID": "xxx.xx",
"Type": "x.xxx.x"
}
}]
},
"TravelPreferences": {
"MaxStopsQuantity": 99,
"TPA_Extensions": {
"DataSources": {
"ATPCO": "Enable",
"LCC": "Disable",
"NDC": "Disable"
},
"NumTrips": {
"Number": 10
}
},
"VendorPref": [{
"Code": "WN"
}]
},
"TravelerInfoSummary": {
"AirTravelerAvail": [{
"PassengerTypeQuantity": [{
"Code": "ADT",
"Quantity": 1
}]
}],
"PriceRequestInformation": {
"TPA_Extensions": {}
},
"SeatsRequested": [1]
},
"TPA_Extensions": {
"IntelliSellTransaction": {
"RequestType": {
"Name": "xxxITINS"
}
}
},
"Version": "3"
}
}
Request#2:
{
"OTA_AirLowFareSearchRQ": {
"MaxResponses": "10",
"OriginDestinationInformation": [{
"RPH": "1",
"DepartureDateTime": "2022-08-20T00:00:00",
"OriginLocation": {
"LocationCode": "SFO"
},
"DestinationLocation": {
"LocationCode": "LAX"
},
"TPA_Extensions": {
"SegmentType": {
"Code": "O"
}
}
}],
"POS": {
"Source": [{
"PseudoCityCode": "xxxx",
"RequestorID": {
"CompanyName": {
"Code": "TN"
},
"ID": "xx.xx",
"Type": "x.xxx.x"
}
}]
},
"TravelPreferences": {
"MaxStopsQuantity": 99,
"TPA_Extensions": {
"DataSources": {
"ATPCO": "Enable",
"LCC": "Disable",
"NDC": "Disable"
},
"NumTrips": {
"Number": 10
}
},
"VendorPref": [{
"Code": "WN"
}]
},
"TravelerInfoSummary": {
"AirTravelerAvail": [{
"PassengerTypeQuantity": [{
"Code": "ADT",
"Quantity": 1
}]
}],
"PriceRequestInformation": {
"TPA_Extensions": {}
},
"SeatsRequested": [1]
},
"TPA_Extensions": {
"IntelliSellTransaction": {
"RequestType": {
"Name": "xxxITINS"
}
}
},
"Version": "3"
}
}
Response#1:
{
"groupedItineraryResponse": {
"version": "6.6.1",
"messages": [{
"severity": "Info",
"type": "SERVER",
"code": "ASE032LPSCIL672.ATSE.CERT.ASCINT.SABRECIRRUS.COM",
"text": "27040"
}, {
"severity": "Info",
"type": "WORKERTHREAD",
"code": "TRANSACTIONID",
"text": "3620995504794847122"
}, {
"severity": "Info",
"type": "DRE",
"code": "RULEID",
"text": "13292"
}, {
"severity": "Info",
"type": "DEFAULT",
"code": "RULEID",
"text": "25238"
}, {
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR QUALIFIERS USED"
}, {
"severity": "Error",
"type": "IF2",
"code": "PROCESS",
"text": "No complete journey can be built in IF2/ADVJR1."
}, {
"severity": "Error",
"type": "ERR",
"code": "ERR",
"text": "Error during Processing"
}],
"statistics": {
"itineraryCount": 0
}
}
}
Response#2:
{
"groupedItineraryResponse": {
"version": "6.3.0",
"messages": [{
"severity": "Info",
"type": "SERVER",
"code": "ASE032LPSCIL744.ATSE.CERT.ASCINT.SABRECIRRUS.COM",
"text": "27035"
}, {
"severity": "Info",
"type": "WORKERTHREAD",
"code": "TRANSACTIONID",
"text": "3623196258955057549"
}, {
"severity": "Info",
"type": "DRE",
"code": "RULEID",
"text": "13292"
}, {
"severity": "Info",
"type": "DEFAULT",
"code": "RULEID",
"text": "25238"
}, {
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR QUALIFIERS USED"
}, {
"severity": "Error",
"type": "IF2",
"code": "PROCESS",
"text": "No complete journey can be built in IF2/ADVJR1."
}, {
"severity": "Error",
"type": "ERR",
"code": "ERR",
"text": "Error during Processing"
}],
"statistics": {
"itineraryCount": 0
}
}
}
Also, tested this using /v1/offers/shop/ in PROD environment using old endpoint and still see the same issue.
Endpoint: https://api.havail.sabre.com/v1/offers/shop,
{
"groupedItineraryResponse": {
"version": "5.2.0",
"messages": [{
"severity": "Info",
"type": "SERVER",
"code": "ASE032LPSPIL9BE.IDM.SGDCPROD.SABRE.COM",
"text": "27041"
}, {
"severity": "Info",
"type": "WORKERTHREAD",
"code": "TRANSACTIONID",
"text": "3629312323318444028"
}, {
"severity": "Info",
"type": "DRE",
"code": "RULEID",
"text": "15943"
}, {
"severity": "Info",
"type": "DEFAULT",
"code": "RULEID",
"text": "17500"
}, {
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR QUALIFIERS USED"
}, {
"severity": "Error",
"type": "IF2",
"code": "PROCESS",
"text": "No complete journey can be built in IF2/ADVJR1."
}, {
"severity": "Error",
"type": "ERR",
"code": "ERR",
"text": "Error during Processing"
}],
"statistics": {
"itineraryCount": 0
}
}
}
Same API call is working fine for other airline codes like Delta Airlines ('DL'), American Airlines ('AA'), United Airlines ('UA'), etc.
Can anyone share any insight on why this is happening and how can we fix this behaviour ?
This error possibly means there’s no flights for this route on WN for this dates.
Try checking WN website and try different dates.
Here's the approach we followed to fix this
In order for us to get southwest airlines(WN) content, the PCC we use has to be whitelisted and southwest airlines(WN) does that by whitelisting using the actual ARC numbers. We have an active ARC number and requested that it be added to the PCC by Sabre as it's already been whitelisted by Southwest. Once Sabre made the changes, the WN content became available for PCC and we could see WN flights being listed when we hit Sabre BFM REST API v4.
FYI - https://developer.sabre.com/guides/travel-agency/concepts/glossary

How to mapping identity fields?

How to setup FieldValueMap for identityRef fields, AssignedTo for example? I migrate from DevOps Services to DevOps Server 2020 Update 1.1
// no work
{
"$type": "FieldValueMapConfig",
"WorkItemTypeName": "*",
"sourceField": "System.AssignedTo.id",
"targetField": "System.AssignedTo.id",
"valueMapping": {
}
}
// migration.exe crash
{
"$type": "FieldValueMapConfig",
"WorkItemTypeName": "*",
"sourceField": "System.AssignedTo",
"targetField": "System.AssignedTo",
"valueMapping": {
{
"displayName": "displayName",
"url": "url",
"_links": {
"avatar": {
"href": "href"
}
},
"id": "id",
"uniqueName": "uniqueName",
"imageUrl": "imageUrl",
"descriptor": "descriptor"
}: {
"displayName": "mapped_displayName",
"url": "mapped_url",
"_links": {
"avatar": {
"href": "mapped_href"
}
},
"id": "mapped_id",
"uniqueName": "mapped_uniqueName",
"imageUrl": "mapped_imageUrl",
"descriptor": "mapped_descriptor"
}
}
}
Can anybody help?
Same issue on github.

Github : How to list milestone updates for an issue

How to list for a specific ticket the current milestone and its precedent assigned ones if applicable (+ date of each milestone update) ? I checked in the github API (https://developer.github.com/v3/issues/#get-a-single-issue) and I can extract the current milestone but not the previous assigned ones (if they exist). Any idea ?
Thank you,
You can use the Issues Events API. To test this I went to a test issue and:
Added milestone new
Added milestone two
After using that endpoint to query the API I got three events, two with type milestoned and one demilestoned. The endpoint allows you to filter for those events specifically to remove noise on very active issues. Here is an example of the reply (with obfuscated data)
[
{
"id": 2193329921,
"url": "https://api.github.com/repos/myOrg/myRepo/issues/events/2193329921",
"actor": {
"login": "myuser",
"id": 1192590,
"node_id": "MDQ6VXNlcjExOTI1OTA=",
"gravatar_id": "",
"url": "https://api.github.com/users/myuser",
"html_url": "https://github.com/myuser",
"followers_url": "https://api.github.com/users/myuser/followers",
"following_url": "https://api.github.com/users/myuser/following{/other_user}",
"gists_url": "https://api.github.com/users/myuser/gists{/gist_id}",
"starred_url": "https://api.github.com/users/myuser/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/myuser/subscriptions",
"organizations_url": "https://api.github.com/users/myuser/orgs",
"repos_url": "https://api.github.com/users/myuser/repos",
"events_url": "https://api.github.com/users/myuser/events{/privacy}",
"received_events_url": "https://api.github.com/users/myuser/received_events",
"type": "User",
"site_admin": true
},
"event": "milestoned",
"commit_id": null,
"commit_url": null,
"created_at": "2019-03-11T09:42:00Z",
"milestone": {
"title": "new"
}
},
{
"id": 2193330104,
"url": "https://api.github.com/repos/myOrg/myRepo/issues/events/2193330104",
"actor": {
"login": "myuser",
"id": 1192590,
"url": "https://api.github.com/users/myuser",
"html_url": "https://github.com/myuser",
"followers_url": "https://api.github.com/users/myuser/followers",
"following_url": "https://api.github.com/users/myuser/following{/other_user}",
"gists_url": "https://api.github.com/users/myuser/gists{/gist_id}",
"starred_url": "https://api.github.com/users/myuser/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/myuser/subscriptions",
"organizations_url": "https://api.github.com/users/myuser/orgs",
"repos_url": "https://api.github.com/users/myuser/repos",
"events_url": "https://api.github.com/users/myuser/events{/privacy}",
"received_events_url": "https://api.github.com/users/myuser/received_events",
"type": "User",
"site_admin": true
},
"event": "demilestoned",
"commit_id": null,
"commit_url": null,
"created_at": "2019-03-11T09:42:04Z",
"milestone": {
"title": "new"
}
},
{
"id": 2193330105,
"url": "https://api.github.com/repos/myOrg/myRepo/issues/events/2193330105",
"actor": {
"login": "myuser",
"url": "https://api.github.com/users/myuser",
"html_url": "https://github.com/myuser",
"followers_url": "https://api.github.com/users/myuser/followers",
"following_url": "https://api.github.com/users/myuser/following{/other_user}",
"gists_url": "https://api.github.com/users/myuser/gists{/gist_id}",
"starred_url": "https://api.github.com/users/myuser/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/myuser/subscriptions",
"organizations_url": "https://api.github.com/users/myuser/orgs",
"repos_url": "https://api.github.com/users/myuser/repos",
"events_url": "https://api.github.com/users/myuser/events{/privacy}",
"received_events_url": "https://api.github.com/users/myuser/received_events",
"type": "User",
"site_admin": true
},
"event": "milestoned",
"commit_id": null,
"commit_url": null,
"created_at": "2019-03-11T09:42:04Z",
"milestone": {
"title": "second"
}
}
]

Working with zoho api's

I am working on ZOHO API's. Using POSTMAN I am trying to GET the details of a project. The API is as follows
GET /portal/[PORTALID]/projects/[PROJECTID]/
Sample Response
Status: 200 Success
Content Type: application/json;charset=utf-8
{
"projects": [{
"id": 170876000000765009,
"task_count": {
"open": 6,
"closed": 7
},
"milestone_count": {
"open": 2,
"closed": 1
},
"bug_count": {
"open": 2,
"closed": 1
},
"name": "Website Design Templates",
"status": "active",
"created_date": "10-22-2012 02:45 PM",
"created_date_long": 1350926134092,
"description": "This project is to discuss different design templates to build a website",
"owner_name": "Patricia Boyle",
"owner_id": "2060758",
"link": {
"self": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/"
},
"activity": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/activities/"
},
"status": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/statuses/"
},
"milestone": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/milestones/"
},
"tasklist": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/tasklists/"
},
"task": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/tasks/"
},
"bug": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/bugs/"
},
"timesheet": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/logs/"
},
"event": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/events/"
},
"document": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/documents/"
},
"folder": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/folders/"
},
"forum": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/forums/"
},
"user": {
"url": "https://projectsapi.zoho.com/restapi/portal/
2063927/projects/170876000000765009/users/"
}
}
}]
}
The link is here
But when I try to GET the details. It gives me 404 error. Below is my request.
https://bugtracker.zoho.com/portal/fasi/projects/7958751212/
Authentication Token: c1d5c4cfd0bfcfd8b10caf0b174hhh
Moreover, in the link, there is nothing given that how to send the request. All there is sample response.
How can I send a correct request to get the details?
Any help would be highly appreciated.

facebook graph - retrieve multiple photos

I want to retrieve all photos that can be posted in a single Facebook post.
For example, in this post, there are two photos.
Using the Graph API (https://graph.facebook.com/v2.6/AtifAslamOfficialFanPage/posts?fields=id,type,created_time,link,message,source,object_id&limit=10&access_token=xxx) I get for this post:
{
"id": "182973122142_10153437154822143",
"type": "photo",
"created_time": "2016-03-18T17:47:23+0000",
"link": "https://www.facebook.com/AtifAslamOfficialFanPage/photos/a.281303247142.151444.182973122142/10153437154412143/?type=3",
"object_id": "10153437154412143"
}
but there is only one object_id, which is the first photo of the post.
Is it possible to retrieve all photos?
Request the attachments field, 182973122142_10153437154822143?fields=attachments, and you will get the following data structure:
{
"attachments": {
"data": [
{
"subattachments": {
"data": [
{
"media": {
"image": {
"height": 266,
"src": "https://scontent.xx.fbcdn.net/v/t1.0-9/s720x720/10314482_10153437154412143_7582591571482186627_n.png?oh=a2b350ce8ac6ae546022295c7e73245a&oe=579E6E12",
"width": 720
}
},
"target": {
"id": "10153437154412143",
"url": "https://www.facebook.com/AtifAslamOfficialFanPage/photos/a.281303247142.151444.182973122142/10153437154412143/?type=3"
},
"type": "photo",
"url": "https://www.facebook.com/AtifAslamOfficialFanPage/photos/a.281303247142.151444.182973122142/10153437154412143/?type=3"
},
{
"media": {
"image": {
"height": 720,
"src": "https://scontent.xx.fbcdn.net/v/t1.0-9/p720x720/10314505_10153437154507143_8615151666809542144_n.jpg?oh=4255fb5699cf0a4d5c455be82cbb8efe&oe=57E38281",
"width": 720
}
},
"target": {
"id": "10153437154507143",
"url": "https://www.facebook.com/AtifAslamOfficialFanPage/photos/a.281303247142.151444.182973122142/10153437154507143/?type=3"
},
"type": "photo",
"url": "https://www.facebook.com/AtifAslamOfficialFanPage/photos/a.281303247142.151444.182973122142/10153437154507143/?type=3"
}
]
},
"target": {
"id": "10153437154822143",
"url": "https://www.facebook.com/AtifAslamOfficialFanPage/posts/10153437154822143"
},
"title": "Photos from Atif Aslam's post",
"type": "album",
"url": "https://www.facebook.com/AtifAslamOfficialFanPage/posts/10153437154822143"
}
]
},
"id": "182973122142_10153437154822143"
}