Commit aa49c20e authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Merge branch 'repository-files-doc' into 'master'

Add examples to repository files API

## What does this MR do?

Add examples to repository files API.

## Why was this MR needed?

There were no examples.

## What are the relevant issue numbers?

fixes #19779


See merge request !5465
parents d4f06e49 3bf62c9d
...@@ -12,6 +12,10 @@ Allows you to receive information about file in repository like name, size, cont ...@@ -12,6 +12,10 @@ Allows you to receive information about file in repository like name, size, cont
GET /projects/:id/repository/files GET /projects/:id/repository/files
``` ```
```bash
curl -X GET -H 'PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK' 'https://gitlab.example.com/api/v3/projects/13083/repository/files?file_path=app/models/key.rb&ref=master'
```
Example response: Example response:
```json ```json
...@@ -39,6 +43,10 @@ Parameters: ...@@ -39,6 +43,10 @@ Parameters:
POST /projects/:id/repository/files POST /projects/:id/repository/files
``` ```
```bash
curl -X POST -H 'PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK' 'https://gitlab.example.com/api/v3/projects/13083/repository/files?file_path=app/project.rb&branch_name=master&content=some%20content&commit_message=create%20a%20new%20file'
```
Example response: Example response:
```json ```json
...@@ -62,6 +70,10 @@ Parameters: ...@@ -62,6 +70,10 @@ Parameters:
PUT /projects/:id/repository/files PUT /projects/:id/repository/files
``` ```
```bash
curl -X PUT -H 'PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK' 'https://gitlab.example.com/api/v3/projects/13083/repository/files?file_path=app/project.rb&branch_name=master&content=some%20other%20content&commit_message=update%20file'
```
Example response: Example response:
```json ```json
...@@ -94,6 +106,10 @@ Currently gitlab-shell has a boolean return code, preventing GitLab from specify ...@@ -94,6 +106,10 @@ Currently gitlab-shell has a boolean return code, preventing GitLab from specify
DELETE /projects/:id/repository/files DELETE /projects/:id/repository/files
``` ```
```bash
curl -X PUT -H 'PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK' 'https://gitlab.example.com/api/v3/projects/13083/repository/files?file_path=app/project.rb&branch_name=master&commit_message=delete%20file'
```
Example response: Example response:
```json ```json
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment