Commit 02693b72 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Explain iid in API

parent 12800e54
...@@ -96,13 +96,30 @@ curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" --header "SUDO: username" "h ...@@ -96,13 +96,30 @@ curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" --header "SUDO: username" "h
curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" --header "SUDO: 23" "http://example.com/api/v3/projects" curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" --header "SUDO: 23" "http://example.com/api/v3/projects"
``` ```
#### Pagination ## Pagination
When listing resources you can pass the following parameters: When listing resources you can pass the following parameters:
+ `page` (default: `1`) - page number + `page` (default: `1`) - page number
+ `per_page` (default: `20`, max: `100`) - number of items to list per page + `per_page` (default: `20`, max: `100`) - number of items to list per page
## id vs iid
When you work with API you may notice two similar fields in api entites: id and iid.
The main difference between them is scope. Example:
Issue
id: 46
iid: 5
* id - is uniq across all Issues table. It used for any api calls.
* iid - is uniq only in scope of single project. When you browse issues or merge requests with Web UI - you see iid.
So if you want to get issue with api you use `http://host/api/v3/.../issues/:id.json`
But when you want to create a link to web page - use `http:://host/project/issues/:iid.json`
## Contents ## Contents
+ [Users](users.md) + [Users](users.md)
......
...@@ -11,6 +11,7 @@ GET /issues ...@@ -11,6 +11,7 @@ GET /issues
[ [
{ {
"id": 43, "id": 43,
"iid": 3,
"project_id": 8, "project_id": 8,
"title": "4xx/5xx pages", "title": "4xx/5xx pages",
"description": "", "description": "",
...@@ -31,6 +32,7 @@ GET /issues ...@@ -31,6 +32,7 @@ GET /issues
}, },
{ {
"id": 42, "id": 42,
"iid": 4,
"project_id": 8, "project_id": 8,
"title": "Add user settings", "title": "Add user settings",
"description": "", "description": "",
...@@ -100,6 +102,7 @@ Parameters: ...@@ -100,6 +102,7 @@ Parameters:
```json ```json
{ {
"id": 42, "id": 42,
"iid": 3,
"project_id": 8, "project_id": 8,
"title": "Add user settings", "title": "Add user settings",
"description": "", "description": "",
......
...@@ -15,6 +15,7 @@ Parameters: ...@@ -15,6 +15,7 @@ Parameters:
[ [
{ {
"id":1, "id":1,
"iid":1,
"target_branch":"master", "target_branch":"master",
"source_branch":"test1", "source_branch":"test1",
"project_id":3, "project_id":3,
...@@ -59,6 +60,7 @@ Parameters: ...@@ -59,6 +60,7 @@ Parameters:
```json ```json
{ {
"id":1, "id":1,
"iid":1,
"target_branch":"master", "target_branch":"master",
"source_branch":"test1", "source_branch":"test1",
"project_id":3, "project_id":3,
......
...@@ -10,6 +10,7 @@ GET /projects/:id/milestones ...@@ -10,6 +10,7 @@ GET /projects/:id/milestones
[ [
{ {
"id":12, "id":12,
"iid":3,
"project_id":16, "project_id":16,
"title":"10.0", "title":"10.0",
"description":"Version", "description":"Version",
......
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