REST API: retrieve a list of files with LOC changed in a commit

In this release, we've extended the REST API resource to retrieve data for a single commit, so now it also returns a list of files changed in a commit with the number of lines of code added and deleted in each file.

By default, the data returned by resource includes:

  • number of lines of code added and deleted in a commit
  • author details
  • commit creation time
  • parent commits' hashes

But if you use the withFiles query parameter set to TRUE, it will also return the following data:

  • files changed in a commit
  • number of lines of code added and deleted in each file

Here is an example of the response:

{
    "id": "9ce548edb1b534029fa0f0617dadc3d54cdb8999",
    "repository": {
        "slug": "hudi",
        "name": "hudi",
        "project": {
            "key": "APACHE",
            "name": "The Apache Software Foundation",
            "type": "NORMAL"
        }
    },
    "parents": [
        {
            "id": "3f8ca1a3552bb866163d"
        }
    ],
    "linesOfCode": {
        "added": 148,
        "deleted": 16
    },
    "author": {
        "displayName": "pengzhiwei",
        "emailAddress": "pengzhiwei2015@icloud.com"
    },
    "authorTimestamp": "2021-08-06T11:18:19+03:00",
    "changedFiles": [
        {
            "linesOfCode": {
                "added": 148,
                "deleted": 16
            },
            "path": "hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/CompactionHoodiePathCommand.scala"
        }
    ]
}
CODE

Learn more about the resource.