Calling API by SSH or by CURL
Possible commands:
user_info
user_rights_list
user_ssh_keys_list
user_wh_list
repo_bug_info
repo_bug_list
repo_list
repo_info
repo_pr_list
user_info
Description: List information abot a user
Parameters: user, uid
Example:
$ curl --header 'Authorization: bla this_is_bla_api_key' \
--data '{"cmd": "user_info", "user": "bla"}' \
@@base_url@@/op/api
$ ssh rocketgit@rocketgit.com api user_info user=bla
{
"ok": 1,
"exists": 1,
"uid": "846",
"is_admin": "0",
"rights": "C",
"homepage": "\/user\/bla",
"username": "bla",
"salt": "3f786850e387550fdab836ed7e6dc881de23001b",
"pass": "162b0b32f024...01cc7884a635be",
"email": "bla@example.com",
"itime": "1440834245",
"suspended": null,
"session_time": "3600",
"last_seen": "1464805192",
"disk_used_mb": null,
"confirmed": "1",
"confirm_token": "c215e946b2b15d66d14b",
"organization": "0",
"realname": "my real name",
"plan_id": "0",
"last_ip": "192.168.79.154",
"itime_nice": "2015-08-29",
"email_md5": "60b725f10c9c85c70d97880dfe8191b3",
"HTML:gravatar": "<img src=\"https:\/\/www.gravatar.com\/avatar\/60...b3?s=64&r=g\" alt=\"avatar\" width=\"64\" height=\"64\" \/>"
}
user_rights_list
Description: Lists user defined rights
Parameters: user
Example:
$ curl --header 'Authorization: bla this_is_bla_api_key' \
--data '{"cmd": "user_rights_list", "user": "bla"}' \
@@base_url@@/op/api
$ ssh rocketgit@rocketgit.com api user_rights_list user=bla
[
{
"type": "repo_path",
"obj_id": "831",
"uid": "0",
"rights": "P",
"itime": "1450417938",
"misc": "",
"prio": "100",
"who": "846",
"right_id": "79",
"ip": "",
"misc2": "",
"Description": "dfdsfds",
"username": "*",
"who_name": "catab",
"rights_text": "Push",
"itime_text": "2015-12-18 05:52",
"ip_nice": "Any",
"HTML:Description_nlbr": "dfdsfds",
"can_be_deleted": 1
},
...
]
user_ssh_keys_list
Description: Lists SSH keys of a user
Parameters: user
Example:
$ curl --header 'Authorization: bla this_is_bla_api_key' \
--data '{"cmd": "user_ssh_keys_list", "user": "bla"}' \
@@base_url@@/op/api
$ ssh rocketgit@rocketgit.com api user_ssh_keys_list user=bla
[
{
"ok": 1,
"type": "ssh-rsa",
"comment": "Key for rocketgit - r1i",
"key": "AAAAB3NzaC1yc2...yTRiD8gFdg9UT1bw==",
"bits": 4096,
"fingerprint_md5": "b1:fd:5f:f0:53:f5:9c:31:b2:de:ff:00:1c:f1:c5:61",
"fingerprint_sha256": "SNPwFw0Snaz7pdUAFV4Lrf8LFHqx93I7VmW5LsjTlLS0",
"key_id": "438",
"itime": "2016-01-27 21:11",
"first_use": "2016-01-27 21:13",
"last_ip": "192.168.79.154",
"last_use": "2016-01-29 18:27",
"last_cmd": "git-receive-pack '\/user\/catab\/delme10'",
"count": "27"
},
...
]
user_wh_list
Description: Lists webhooks of a user
Parameters: user
Example:
$ curl --header 'Authorization: bla this_is_bla_api_key' \
--data '{"cmd": "user_wh_list", "user": "bla"}' \
@@base_url@@/op/api
$ ssh rocketgit@rocketgit.com api user_wh_list user=bla
[
{
"id": "648",
"uid": "846",
"itime": "1454001110",
"Description": "Test Slack integration",
"add_ip": "192.168.79.154",
"last_output": "* Trying ...H5pQ==\r\n\r\nok",
"idata": {
"debug": "0",
"events": "P",
"url": "https:\/\/hooks.slack.com\/services\/T...D\/B...N\/j...E",
"itype": "2",
"client_cert": "",
"client_ca_cert": "",
"opaque": "",
"key": "",
"custom_body": "{\n \"cha...host:\"\n}",
"events_text": "Push",
"itype_text": "Custom (use custom body field)",
"HTML:client_cert_short": "n\/a",
"HTML:client_ca_cert_short": "n\/a",
"HTML:custom_body_nlbr": "{<br \/>... \/>\n}",
"HTML:private": "<table ...<\/table>\n"
},
"htype": "http",
"flags": "",
"refname": "(test1|master)",
"repo": ".*10",
"itime_nice": "2016-01-28 17:11",
"HTML:flags_text": "",
"HTML:Description_nice": "Test Slack integration",
"HTML:last_output_nice": "* Try...\r\nok"
},
...
]
repo_bug_info
Description: Shows information about a bug
Parameters: name/repo_id, bug_id
Example:
$ curl --header 'Authorization: bla this_is_bla_api_key' \
--data '{"cmd": "repo_bug_info", "name": "repo1", "bug_id": 2}' \
@@base_url@@/op/api
$ ssh rocketgit@rocketgit.com api repo_bug_info name=repo1 bug_id=2
{
"bug_id": "2",
"title": "dsdasds",
"body": "OS type(s) and version(s)?",
"state": "1",
"labels": "",
"assigned_to": "bla",
"assigned_uid": "846",
"itime": 1464812804,
"utime": 1464812804,
"ip": "192.168.79.154",
"repo_id": "1088",
"uid": "846",
"deleted": 0,
"ok": 1,
"exists": 1,
"owner": "catab",
"HTML:body_nlbr": "OS type(s) and version(s)?",
"creation": "2016-06-01 20:26",
"updated": "2016-06-01 20:26",
"deleted_text": "",
"deleted_who_name": "",
"state_text": "Open"
}
repo_bug_list
Description: Lists the bugs
Parameters: name, repo_id
Example:
$ curl --header 'Authorization: bla this_is_bla_api_key' \
--data '{"cmd": "repo_bug_list", "name": "repo1"}' \
@@base_url@@/op/api
$ ssh rocketgit@rocketgit.com api repo_bug_list name=repo1
[
"1",
"2",
"3"
]
repo_list
Parameters: none
Example:
$ curl --header 'Authorization: bla this_is_bla_api_key' \
--data '{"cmd": "repo_list"}' \
@@base_url@@/op/api
$ ssh rocketgit@rocketgit.com api repo_list
[
"repo1",
"repo2",
"repo3"
]
repo_info
Description: Shows info about a repository
Parameters: name, repo_id
Example:
$ curl --header 'Authorization: bla this_is_bla_api_key' \
--data '{"cmd": "repo_info", "name": "repo1"}' \
@@base_url@@/op/api
$ ssh rocketgit@rocketgit.com api repo_info name=repo1
{
"repo_id": "769",
"name": "repo1",
"uid": "846",
"itime": "1447874006",
"disk_quota_mb": null,
"max_commit_size": "0",
"master": "0",
"Description": "here is a Description",
"git_dir_done": "1",
"deleted": "0",
"disk_used_mb": "0",
"public": "1",
"last_bug_id": "1",
"license": "GPLv3",
"template": "",
"last_mr_id": "0",
"ok": 1,
"exists": 1,
"clone_url": "ssh:\/\/rocketgit@rg.embedromix.ro:2222\/user\/bla\/repo1",
"HTML:Description_nlbr": "here is a Description",
"HTML:itime_nice": "2015-11-18",
"owner": "bla",
"url_user": "http:\/\/r1i:9000\/user\/bla",
"url_repo": "http:\/\/r1i:9000\/user\/bla\/repo1",
"clone_url_ssh": "ssh:\/\/rocketgit@rg.embedromix.ro:2222\/user\/bla\/repo1",
"clone_url_git": "git:\/\/rg.embedromix.ro\/user\/bla\/repo1",
"master_name": "-",
"disk_used": "0B"
}
repo_pr_list
Description: Lists the pull requests
Parameters: name, repo_id
Example:
$ curl --header 'Authorization: bla this_is_bla_api_key' \
--data '{"cmd": "repo_pr_list", "name": "repo1"}' \
@@base_url@@/op/api
$ ssh rocketgit@rocketgit.com api repo_pr_list name=repo1
[
{
"repo_id": "769",
"itime": "1330296541",
"namespace": "rg_b21751c3",
"refname": "refs\/heads\/master",
"old_rev": "afd1df2940fe440cde9b8ede988ff24c051a10d6",
"new_rev": "f919c9bf863471aeb97da6aa2380319a1bee6eda",
"done": "0",
"ip": "2002:2e66:5950::1",
"id": "5",
"who": "0"
},
...
]