Add REST endpoint to get content of a file from HEAD of a branch
By GET on /projects/<project-name>/branches/<branch>/files/<file>/content
it is now possible to retrieve the content of a file from the HEAD
revision of a certain branch. The file content is returned as base64
encoded string.
This endpoint is useful for integrating tools that need access to
certain files, e.g. a tool may need to get the pom.xml from every
project. In this case it would be too much overhead to clone each
repository just to get this one file from it.
Change-Id: I70f294fbcc8a4cc88cd3c1265653cc9870b6433e
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/Documentation/rest-api-projects.txt b/Documentation/rest-api-projects.txt
index c478e79..fed5b04 100644
--- a/Documentation/rest-api-projects.txt
+++ b/Documentation/rest-api-projects.txt
@@ -742,6 +742,31 @@
HTTP/1.1 204 No Content
----
+[[get-content]]
+Get Content
+~~~~~~~~~~~
+--
+'GET /projects/link:#project-name[\{project-name\}]/branches/link:#branch-id[\{branch-id\}]/files/link:rest-api-changes.html#file-id[\{file-id\}]/content'
+--
+
+Gets the content of a file from the HEAD revision of a certain branch.
+
+.Request
+----
+ GET /projects/gerrit/branches/master/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...
+----
+
[[child-project-endpoints]]
Child Project Endpoints
-----------------------