From 59f428dca20228984e9f50c33b12f54eb15638e5 Mon Sep 17 00:00:00 2001 From: Alex Van't Hof Date: Tue, 27 Aug 2013 21:22:42 -0400 Subject: Standardize commit diff api url, change blob api url, add get single commit Use "/commits/:sha/diff" as opposed to "/commit/:sha", keeping in line with existing api urls (e.g. "/projects/:id", etc.) Fix 500 error resulting from a diff api call with an invalid commit hash Move "/commits/:sha/blob" to "/blobs/:sha", leaving the old path for backwards compatibility. Add ability to get a single commit via "/commits/:sha" --- doc/api/repositories.md | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'doc/api') diff --git a/doc/api/repositories.md b/doc/api/repositories.md index 229d4409ea6..cb0626972e5 100644 --- a/doc/api/repositories.md +++ b/doc/api/repositories.md @@ -239,12 +239,37 @@ Parameters: ] ``` +## Get a single commit + +Get a specific commit identified by the commit hash or name of a branch or tag. + +``` +GET /projects/:id/repository/commits/:sha +``` + +Parameters: + ++ `id` (required) - The ID of a project ++ `sha` (required) - The commit hash or name of a repository branch or tag + +```json +{ + "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6", + "short_id": "6104942438c", + "title": "Sanitize for network graph", + "author_name": "randx", + "author_email": "dmitriy.zaporozhets@gmail.com", + "created_at": "2012-09-20T09:06:12+03:00" +} +``` + + ## Get the diff of a commit Get the diff of a commit in a project. ``` -GET /projects/:id/repository/commit/:sha +GET /projects/:id/repository/commits/:sha/diff ``` Parameters: @@ -323,7 +348,7 @@ Parameters: Get the raw file contents for a file. ``` -GET /projects/:id/repository/commits/:sha/blob +GET /projects/:id/repository/blobs/:sha ``` Parameters: -- cgit v1.2.1