Rest API for Pull request approval process - azure-devops-rest-api

As I am trying to integrate Azure DevOps rest API in our application (Using C#). I am not able to find any API for pull request Approval process.
Please suggest and provide any solution for Approval process using REST API or other alternatives.

In your C# application code:
If you want to create, update or delete the branch policies related to Pull Request Approval (Reviewers), you can use the "PolicyConfiguration Class" from the related .NET client libraries for Azure DevOps. The corresponding Azure DevOps REST API is "Configurations".
For "Require a minimum number of reviewers", the 'configurationId' is 'fa4e907d-c16b-4a4c-9dfa-4906e5d171dd'.
For "Automatically included reviewers", the 'configurationId' is 'fd2167ab-b0be-447a-8ec8-39368250530e'.
If you want to add, remove reviewers from Pull Request, or set the votes (Approve, Reject, Approve with suggestions, Wait for author, etc..) of reviewers on Pull Request, you can use the "ReviewersUpdatedEvent Class", "ReviewersVotesResetEvent Class" and "ReviewerVoteUpdatedEvent Class". The corresponding Azure DevOps REST API is "Pull Request Reviewers".
[UPDATE]
Below are some samples about using .NET client libraries for Azure DevOps in C# code:
C# client library samples
microsoft/azure-devops-dotnet-samples

Related

Rest API to Perform CRUD operation on Devops Server Permission Groups

There is a graph Web API for accessing Permission Groups in Devops Online. The Azure CLI also provides an interface for this same functionality. The Graph API and Azure CLI are not available for Azure Devops 2020 Server. I am having trouble finding the corresponding interface for Azure Devops Server. Does anyone know if there is an interface and if so can you point in the right direction?
Thanks!

API to fetch last login date jira cloud

Is there any JIRA REST API which can give information about last login time of all users for jira cloud platform?
If yes, then please provide me the details of the request URL.
it is not available (as of June 2022), they have a request but they are not considering it yet:
https://jira.atlassian.com/browse/ID-6965
there might be some custom plugins extending the REST API for server but I doubt they would allow such a plugin on the cloud side

Exchange OAuth settings in 3rd party apps don't allow you to reffer to specific folders in a mailbox

I am trying to configure a mailbox on Exchange Online to be used by our Deskpro ticketing system to manage several queues. The only way I could setup Deskpro to recognise different folders in the mailbox was to make the connection using EWS. MS said they would be deprecating EWS Basic Auth in October last year, does that mean my EWS connection via outlook.office365.com/EWS/Exchange.asmx is now authenticating through OAuth? It still works, I'm concerned MS will change something and it'll stop working.
I'd love to use the OAuth via Graph, but if I select that option in the Deskpro setup there's no way to identify individual folders for each queue to process meaning I'd have to have a separate mailbox for each queue requiring an Exchange Plan license for each!
Collin, yes there is an announcement made to deprecate EWS Basic auth (it was made quite some time earlier too) and move to modern auth/oAuth too - it will work for you. Also you know that no new investments are going to be made in EWS, so you wont get any new features. So keeping in that mind, you can use EWS modern auth/oAuth for a while, but i would recommend you to create plan to move to Microsoft Graph API - so that you can interact with all the existing features in EWS and connect with entire Microsoft Graph ecosystem's product/solutions as well.

Authenticate to external API from a Jira add-on

I am building a Jira add-on that gives provides the user with the status of an object within my own API (not within Jira). My API is protected using OAuth 2.0. What is the best way to authenticate to my API from my Jira add-on?
I like how the Jira + GitHub/Bitbucket integration works. Specifically, the user retrieves API keys from GitHub and puts them in Jira. Jira then uses these keys to authenticate with and then retrieve data from GitHub. At least, this is how I think it works.
How can I achieve this same effect for my Jira add-on?
When you are building a cloud add-on then you can handle authentication without bothering admins (they don't need to copy anything).
To integrate yourself with Jira UI you need to create a webpanel or page, in both cases, Jira will ask your site to render the HTML code and the request will include JWT token. Inside you will have information about which user did the request.
Now, you can authenticate Jira users to your API in several ways:
render a time-limited token to the HTML and use it to authenticate calls to your API. As a downside of this solution, if someone will keep the page open without reloading for long enough (longer than your time limit) the token will become invalid.
provide a resource to retrieve time-limited token (validate JWT signature provided by Jira to be sure request really comes from particular Jira instance) and retrieve the token every time before doing the request (or every N minutes depending on your time limit).
or if you really want to bother admins then create a configuration page and let them save API keys by hand (I assume they will have to retrieve those keys from you somehow, this additional step may discourage many admins), in this configuration page you will include JS code that on submit will save API keys as Application property and later you will have to retrieve this before making requests to your API. With this approach however, admins will not be able to restrict access to your API to a subset of users with Jira permissions (every logged in user can access application properties, in open instances even anonymous users).
If you are unsure how to validate JWT Token you can read this developer guide. Also, you can make your life easier by using one of the provided framework and tools, for example, atlassian-connect-spring-boot will take care of installation handshake, JWT authentication and authentication to Jira REST API from your server.

How to use Jira rest APIs in WebHooks with Oauth authoization

I have a requirement to download attachments from Jira during event triggers and upload back to other supporting tool. For this purpose, started using WebHooks, during event trigger, json values will get passed thru post call. I have found Jira rest api also to get attachment download link to use it in webhooks. But this rest api requires valid authentication. I can't use basic login details to hard code in the script for downloading through URL.
How can I authorize this URL for getting the attachment. I heard that, we can establish OAuth and for this I need to enable application linking. At this stage, I am not sure how can I link the WebHook URL as an application. Current Hook is not a complete application it just accepts json as post and parses through it.
Need your support how to enable this OAuth and how to create that app. I am newbie to this WebHooks and OAuth concepts. so bare me for the generic queries .. :)
If there are any other possible solutions for my requirement are also welcomed.
Thank you..

Resources