Comments (8)
It's not obvious from the docs, but you need to use the PR Iterations API. Use this to list the iterations in the PR, then you want to get the number of the latest iteration. Then, you can use PR Iteration Changes to get the list of changes for an iteration, or between two iterations. If you want all changes, use the latest iteration and set the compareTo=0
.
Once you have the list of changes, you need to use the Items API to get the actual contents.
Hopefully that helps until we can get some better samples posted.
cc @steved0x
from vsts-rest-api-specs.
@mmitrik Thanks. I can get list of files changed in the PR using iteration changes. But I am still not able to get the diff between files. The Items api just returns be the file for a given commit. Is there a way I can see what changed in a file (lines added/removed/modified)?
from vsts-rest-api-specs.
So I was working on trying to create an extension for vscode that integrates with AZDO and wanted to get the diff of the files before I landed on this issue. Don't even remember when I raised it ๐ธ. Well anyways, is there an update for this? @mmitrik You would have moved on to other roles so can you recommend someone I can connect with directly?
cc: @tedchamb since you are the top contributor.
from vsts-rest-api-specs.
Not positive of the best person for this. @aaronhallberg might be able to advise.
from vsts-rest-api-specs.
@goflores, who would be the best person to help with this REST API question?
from vsts-rest-api-specs.
@ankitbko Try to swap target and base versions, that will do the trick. But it won't show you the diff, only path of changed and change type, you can check samples here
Use this to get diff:
Step1: Use the Rest API to get commit id from PR.
Step2: You could use the Rest API to get the commit by commit id.
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits/{commitId}?changeCount={changeCount}&api-version=5.0
In the Rest API Result, you need to record the value of โparentsidโ, โpathโ.
Step3: You could use the following API to get the diff content.
Post https://dev.azure.com/{organization}/{project}/_api/_versioncontrol/fileDiff?__v=5&diffParameters={value}&repositoryId={repositoryid}
The {value} is Json type.
Here is an example:
{"originalPath":"filepath","originalVersion":"Parentsid","modifiedPath":"filepath","modifiedVersion":"commitid","partialDiff":true,"includeCharDiffs":true}
You could add the value to the API URL.
from vsts-rest-api-specs.
Thank you. I didnt see fileDiff api in the documentation though.
from vsts-rest-api-specs.
_api/_versioncontrol/fileDif is giving 404 for my instance.
from vsts-rest-api-specs.
Related Issues (20)
- Not enough details to add additional provenance data to universal package
- Graph Users Create "Request Body" section incorect
- Typo "a Azure DevOps"โ"an Azure DevOps"
- Typo "a Azure DevOps"โ"an Azure DevOps"
- Typo "a Azure DevOps"โ"an Azure DevOps"
- GIT policy configurations does not return any values
- Team Name missing in URL of the teamfieldvalues examples
- Rest api - Is it possible to get stage info included?
- No mention of arrays
- List items API doesn't return the Author's ImageUrl property
- Get a repository by remote URL example misleadingly broken.
- Dead URL on Azure DevOps Services REST API Reference HOT 1
- Filter build on repositoryId or repositoryType fail with Bad Request
- Update document for ConvertAuthenticationScheme
- Unable to create dashboard with example
- Is there a limit on the number that can be returned?
- [Suggestion/Question] Azure DevOps > Git > Diffs - Is there a way to get the actually line changes (Git diff) through the api?
- Wrong status code
- API documentation does not seem to conform to actual behavior - does it need update?
- Better examples - an exact command
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vsts-rest-api-specs.