Add REST endpoint to get content of a file in a commit It is already possible to get the content of a file from the HEAD revision of a branch. Add the same functionality for arbitrary commits. Change-Id: Id8e48bb40b4f383997aa9b83440a57ab90e763ee Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/Documentation/rest-api-projects.txt b/Documentation/rest-api-projects.txt index 7c4f479..b4e42db 100644 --- a/Documentation/rest-api-projects.txt +++ b/Documentation/rest-api-projects.txt
@@ -1025,6 +1025,30 @@ } ---- +[[get-content]] +=== Get Content +-- +'GET /projects/link:#project-name[\{project-name\}]/commits/link:#commit-id[\{commit-id\}]/files/link:rest-api-changes.html#file-id[\{file-id\}]/content' +-- + +Gets the content of a file from a certain commit. + +.Request +---- + GET /projects/work%2Fmy-project/commits/a8a477efffbbf3b44169bb9a1d3a334cbbd9aa96/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0 +---- + +The content is returned as base64 encoded string. + +.Response +---- + HTTP/1.1 200 OK + Content-Disposition: attachment + Content-Type: text/plain;charset=UTF-8 + + Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY... +---- + [[dashboard-endpoints]] == Dashboard Endpoints