Projects API
- List projects
- Get a single project
- Get project id
- Get all references of project
- Update a single project
- Create project
- Destroy project
- Fork project
- Alias project
- Members of a single project
- Add member to a single project
- Remove member from a single project
- Update member role for a single project
List projects
List all projects across all the authenticated user’s projects including owned projects, member projects, and group projects.
GET /api/v1/projects.json
Response:
{
"projects": [
{
"id": "project id",
"name": "project name",
"visibility": "visibility (open/hidden)",
"fullname": "project fullname",
"url": "url to project data page",
"git_url": "path to project git",
"ssh_url": "path to project git over ssh",
"maintainer": {
"id": "user id",
"uname": "user uname",
"name": "user name",
"url": "api user path",
"email": "user email"
},
"description": "description",
"ancestry": "project ancestry",
"has_issues": "true if issues enabled",
"has_wiki": "true if wiki enabled",
"default_branch": "git branch used by default",
"is_package": "true if project is package",
"publish_i686_into_x86_64": "true if i686 packages will be also published into x86_64 repository",
"created_at": "created at date and time",
"updated_at": "updated at date and time",
"owner": {
"id": "owner id",
"name": "owner name",
"type": "owner type",
"url": "path to owner data"
}
}
],
"url": "path to projects data"
}
Example:
{
"projects": [
{
"id": 666,
"name": "evil_tools",
"visibility": "open",
"fullname": "abf/evil_tools",
"url": "/api/v1/projects/666.json",
"git_url": "https:/ivan@abf.rosalinux.ru/jaroslav_garkin/hwinfo.git",
"ssh_url": "git@abf.rosalinux.ru:jaroslav_garkin/hwinfo.git",
"maintainer": {
"id": 1,
"name": "Ivan Aivazovsky",
"uname": "ivan_aivazovsky",
"url": "/api/v1/users/1.json",
"email": "ivan.aivazovsky@email.ru "
},
"description": "bla-bla-bla",
"ancestry": null,
"has_issues": true,
"has_wiki": false,
"default_branch": "master",
"is_package": true,
"publish_i686_into_x86_64": false,
"created_at": 1348168705,
"updated_at": 1348168905,
"owner": {
"id": 4,
"name": "Yaroslav Garkin",
"type": "User",
"url": "/api/v1/users/4.json"
}
}
],
"url": "/api/v1/projects.json"
}
Get a single project
GET /api/v1/projects/:id.json
Parameters:
- id
- Required Integer identifier of current project.
Response:
{
"project": {
"id": "project id",
"name": "project name",
"visibility": "visibility (open/hidden)",
"fullname": "project fullname",
"url": "url to project data page",
"git_url": "path to project git",
"ssh_url": "path to project git over ssh",
"maintainer": {
"id": "maintainer id",
"name": "maintainer name",
"uname": "maintainer uname",
"url": "path to owner data"
},
"description": "description",
"ancestry": "project ancestry",
"has_issues": "true if issues enabled",
"has_wiki": "true if wiki enabled",
"default_branch": "git branch used by default",
"is_package": "true if project is package",
"publish_i686_into_x86_64": "true if i686 packages will be also published into x86_64 repository",
"created_at": "created at date and time",
"updated_at": "updated at date and time",
"owner": {
"id": "owner id",
"name": "owner name",
"type": "owner type",
"url": "path to owner data"
},
"project_statistics": [
{
"average_build_time": "average build time for this project (sec.)",
"build_count": "count of builds",
"arch_id": "architecture of build lists"
}
],
"repositories": [
{
"id": "repository for package storage id",
"name": "repository for package storage name",
"url": "path to repository data page",
"platform": {
"id": "repository platform id",
"name": "repository platform name",
"url": "path to repository platform data page"
}
}
]
}
}
Example:
{
"project": {
"id": 666,
"name": "evil_tools",
"visibility": "open",
"fullname": "abf/evil_tools",
"url": "/api/v1/projects/666.json",
"git_url": "https:/ivan@abf.rosalinux.ru/jaroslav_garkin/hwinfo.git",
"ssh_url": "git@abf.rosalinux.ru:jaroslav_garkin/hwinfo.git",
"maintainer": {
"id": 4,
"name": "Yaroslav Garkin",
"uname": "yaroslav_garkin",
"url": "/api/v1/users/4.json"
},
"description": "bla-bla-bla",
"ancestry": null,
"has_issues": true,
"has_wiki": false,
"default_branch": "master",
"is_package": true,
"publish_i686_into_x86_64": false,
"created_at": 1348168705,
"updated_at": 1348168905,
"owner": {
"id": 4,
"name": "Yaroslav Garkin",
"type": "User",
"url": "/api/v1/users/4.json"
},
"project_statistics": [
{
"average_build_time": 100,
"build_count": 3,
"arch_id": 1
},
{
"average_build_time": 555,
"build_count": 7,
"arch_id": 2
}
],
"repositories": [
{
"id": 1,
"name": "main",
"url": "/api/v1/repositories/1.json",
"platform": {
"id": 1,
"name": "mdv_main",
"url": "/api/v1/platforms/1.json"
}
},
{
"id": 3,
"name": "main",
"url": "/api/v1/repositories/3.json",
"platform": {
"id": 3,
"name": "warpc_personal",
"url": "/api/v1/platforms/3.json"
}
}
]
}
}
Get project id
GET /api/v1/projects/get_id.json?name=:project_name&owner=:owner_name
Parameters:
- project_name
- String project name.
- owner_name:
- String project owner name.
Request examples:
/api/v1/projects/get_id.json?name=rails&owner=warpc
Response:
{
"project": {
"id": "resource id",
"name": "name",
"fullname": "fullname",
"visibility": "visibility (open/hidden)",
"owner": {
"id": "owner id",
"name": "owner name",
"url": "url to owner profile"
},
"url": "url to project data page",
"git_url": "path to project git"
}
}
Example:
{
"project": {
"id": 4661,
"name": "hwinfo",
"fullname": "jaroslav_garkin/hwinfo",
"visibility": "open",
"owner": {
"id": 4,
"name": "Yaroslav Garkin",
"type": "User",
"url": "/api/v1/users/4.json"
},
"url": "/api/v1/projects/4661.json",
"git_url": "https:/ivan@abf.rosalinux.ru/jaroslav_garkin/hwinfo.git"
}
}
Get all references of project
GET /api/v1/projects/:id/refs_list.json
Parameters:
- id
- Required Integer identifier of current project.
Response:
{
"refs_list": [
{
"ref": "reference",
"object": {
"type": "type of reference (tag or commit)",
"sha": "sha"
}
}
],
"url": "url to project refs_list page"
}
Example:
{
"refs_list": [
{
"ref": "master",
"object": {
"type": "commit",
"sha": "3d1468bbb339c8b59234a5bbc35dedf3d89c2043"
}
},
{
"ref": "v.0.0.1",
"object": {
"type": "tag",
"sha": "3d5d7af0e429ecad2b0b1b752235cdd0f9d51a6f"
}
}
],
"url": "/api/v1/projects/667/refs_list.json"
}
Update a single project
PUT /api/v1/projects/:id.json
Parameters:
- id
- Required Integer identifier of current project.
Input:
- name:
- Optional String project name.
- description:
- Optional String project description.
- visibility:
-
Optional String project visibility (
open
/hidden
). - is_package:
-
Optional Boolean
true
if project is package. - default_branch:
- Optional String project default branch.
- has_issues:
- Optional Boolean enable/disable project Issues tracker.
- has_wiki:
- Optional Boolean enable/disable project wiki.
- maintainer_id:
- Optional Integer identifier of project maintainer.
- publish_i686_into_x86_64:
- Optional Boolean enable/disable publishing i686 packages into x86_64 repository (only for rhel).
Request:
{
"project": {
"name": "project_name",
"description": "description",
"has_issues": true,
"has_wiki": false,
"maintainer_id": 15,
"visibility": "open",
"is_package": true,
"default_branch": "master",
"publish_i686_into_x86_64": false
}
}
Response:
{
"project": {
"id": "project id (null if failed)",
"message": "success or fail message"
}
}
Example:
{
"project": {
"id": 12,
"message": "Project has been updated successfully"
}
}
Create project
POST /api/v1/projects.json
Input:
- name:
- Required String project name.
- owner_id:
- Required Integer identifier of project owner.
- owner_type:
- Required String type of project owner.
- visibility:
-
Required String project visibility (
open
/hidden
). - description:
- Optional String project description.
- is_package:
-
Optional Boolean
true
if project is package. Default value:true
. - default_branch:
-
Optional String project default branch. Default value:
master
. - has_issues:
-
Optional Boolean enable/disable project Issues tracker. Default value:
true
. - has_wiki:
-
Optional Boolean enable/disable project wiki. Default value:
false
. - maintainer_id:
- Optional Integer identifier of project maintainer. Default value: current user.
- publish_i686into_x8664:
- Optional Boolean enable/disable publishing i686 packages into x86_64 repository (only for rhel).
Request:
{
"project": {
"name": "project_name",
"description": "description",
"has_issues": true,
"has_wiki": false,
"maintainer_id": 15,
"visibility": "open",
"is_package": true,
"default_branch": "master",
"publish_i686_into_x86_64": false,
"owner_id": 56,
"owner_type": "Group"
}
}
Response:
{
"project": {
"id": "project id (null if failed)",
"message": "success or fail message"
}
}
Examples:
{
"project": {
"id": 12,
"message": "Project has been created successfully"
}
}
Destroy project
DELETE /api/v1/projects/:id.json
Parameters:
- id
- Required Integer identifier of current project.
Request example:
/api/v1/projects/54.json
Response:
{
"project": {
"id": "project id (null if failed)",
"message": "success or fail message"
}
}
Examples:
{
"project": {
"id": 12,
"message": "Project has been destroyed successfully"
}
}
Fork project
POST /api/v1/projects/:id/fork.json
Parameters:
- id
- Required Integer identifier of current project.
- fork_name
- Optional String name of new project.
Input:
- group_id:
- Optional Integer identifier of group which will be project owner. By default (empty request) current user will be project owner.
Request:
{
"fork_name": "new_name"
}
{
"group_id": 15
}
Response:
{
"project": {
"id": "project id (null if failed)",
"message": "success or fail message"
}
}
Examples:
{
"project": {
"id": 12,
"message": "Project has been forked successfully"
}
}
Alias project
POST /api/v1/projects/:id/alias.json
Parameters:
- id
- Required Integer identifier of current project.
- fork_name
- Optional String name of new project.
Input:
- group_id:
- Optional Integer identifier of group which will be project owner. By default (empty request) current user will be project owner.
Request:
{
"fork_name": "new_name"
}
{
"group_id": 15
}
Response:
{
"project": {
"id": "project id (null if failed)",
"message": "success or fail message"
}
}
Examples:
{
"project": {
"id": 12,
"message": "Project has been forked successfully"
}
}
Members of a single project
GET /api/v1/projects/:id/members.json
Parameters:
- id
- Required Integer identifier of current project.
Request example:
/api/v1/projects/53/members.json
Response:
{
"project": {
"id": "project id",
"members": [
{
"id": "member id",
"type": "User or Group type of member",
"url": "member path"
}
]
},
"url": "members path"
}
Example:
{
"project": {
"id": 77,
"members": [
{
"id": 31,
"type": "User",
"url": "/api/v1/users/31.json"
},
{
"id": 22,
"type": "Group",
"url": "/api/v1/groups/31.json"
}
]
},
"url": "/api/v1/projects/77/members.json"
}
Add member to a single project
PUT /api/v1/projects/:id/add_member.json
Parameters:
- id
- Required Integer identifier of current project.
Input:
- member_id
- Required Integer identifier of new member.
- type
-
Required String
Group
orUser
type of new member. - role
-
Required String role for new member (
reader
/writer
/admin
).
Request:
{
"member_id": 34,
"type": "User",
"role": "admin"
}
Response:
{
"project": {
"id": "project id (null if failed)",
"message": "success or fail message"
}
}
Examples:
{
"project": {
"id": 56,
"message": "User '32' has been added to project successfully"
}
}
{
"project": {
"id": 56,
"message": "Group '31' has been added to project successfully"
}
}
Remove member from a single project
DELETE /api/v1/projects/:id/remove_member.json
Parameters:
- id
- Required Integer identifier of current project.
Input:
- member_id
- Required Integer identifier of member.
- type
-
Required String
Group
orUser
type of member.
Request:
{
"member_id": 34,
"type": "User"
}
Response:
{
"project": {
"id": "project id (null if failed)",
"message": "success or fail message"
}
}
Examples:
{
"project": {
"id": 56,
"message": "User '32' has been removed from project successfully"
}
}
{
"project": {
"id": 56,
"message": "Group '31' has been removed from project successfully"
}
}
Update member role for a single project
PUT /api/v1/projects/:id/update_member.json
Parameters:
- id
- Required Integer identifier of current project.
Input:
- member_id
- Required Integer identifier of member.
- type
-
Required String
Group
orUser
type of member. - role
-
Required String new role for member (
reader
,writer
,admin
).
Request:
{
"member_id": 34,
"type": "User",
"role": "admin"
}
Response:
{
"project": {
"id": "project id (null if failed)",
"message": "success or fail message"
}
}
Examples:
{
"project": {
"id": 56,
"message": "Role for user '34' has been updated in project successfully"
}
}
{
"project": {
"id": 56,
"message": "Role for group '31' has been updated in project successfully"
}
}