From a7795730b163ed5daf0e0f31debbf6d73e4e3fa0 Mon Sep 17 00:00:00 2001 From: Jochum van der Ploeg Date: Mon, 1 Apr 2019 02:45:23 +0000 Subject: Update to the commits.md, more details about how to use the --form method for creating a commit --- doc/api/commits.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/doc/api/commits.md b/doc/api/commits.md index 7a044ce881a..c8c282a71d9 100644 --- a/doc/api/commits.md +++ b/doc/api/commits.md @@ -155,6 +155,32 @@ Example response: } ``` +GitLab supports [form encoding](../README.md#encoding-api-parameters-of-array-and-hash-types). The following is an example using Commit API with form encoding: + +```bash +curl --request POST \ + --form "branch=master" \ + --form "commit_message=some commit message" \ + --form "start_branch=master" \ + --form "actions[][action]=create" \ + --form "actions[][file_path]=foo/bar" \ + --form "actions[][content]=" \ + "https://gitlab.example.com/api/v4/projects/1/repository/commits" +``` + ## Get a single commit Get a specific commit identified by the commit hash or name of a branch or tag. -- cgit v1.2.3