Skip to content

guillearria/github-success-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GitHub Success REST API

Overview

This API serves to provide developers with statistics about specific GitHub repositories. The endpoints below provide data formatted to be used with a visualization library such as Plotly.js. Built with Python, Flask, Flask-RESTful, PyGitHub, Pandas, and AWS Elastic Beanstalk.

Authentication

Each endpoint requires an authorization header for the data to be accessed. This authorization header must include a personal access token (PAT) provided by GitHub.

HTTP Response Codes

Each response will be returned with one of the following HTTP status codes:

  • 200 OK The request was successful
  • 400 Bad Request There was a problem with the request (missing authorization header)
  • 404 Not found An attempt was made to access a resource that does not exist in the API
  • 405 Method not allowed The resource being accessed doesn't support the method specified (GET, POST, etc.).
  • 500 Server Error An error on the server occurred (bad credentials, ie. access token)

Development

  • git clone
  • cd api
  • pipenv shell
  • pipenv install
  • python app.py

Resources

Owner/Repo Summary

Returns a list of two dictionaries, the first contains data about the requested owner and the second contains a few statistics about the requested repository.

Request

GET http://githubsuccessapi-env.eba-8utmmuhi.us-east-1.elasticbeanstalk.com/repo-summary/kubernetes/kubernetes

Response

[
  {
    "avatar_url": "https://avatars2.githubusercontent.com/u/13629408?v=4",
    "gh_url": "https://api.github.com/users/kubernetes",
    "name": "Kubernetes",
    "login": "kubernetes"
  },
  {
    "watchers": 3233,
    "stars": 69042,
    "forks": 24888,
    "full_name": "kubernetes/kubernetes",
    "description": "Production-Grade Container Scheduling and Management",
    "homepage_url": "https://kubernetes.io",
    "languages_url": "https://api.github.com/repos/kubernetes/kubernetes/languages",
    "updated": "Sat, 15 Aug 2020 03:09:43 GMT",
    "contributors": 383,
    "total_commits": 93298,
    "open_pull_requests": 1005
  }
]

Top 10 All-Time Contributors

Returns the top 10 all-time contributors along with their total commits and follower count for the requested repository. Will require JSON.parse(response).

Request

GET http://githubsuccessapi-env.eba-8utmmuhi.us-east-1.elasticbeanstalk.com/visualization/top-10-contributors/kubernetes/kubernetes

Response

{
  "user": ["lavalamp", "mikedanese", "thockin", "caesarxuchao", "brendandburns", "sttts", "deads2k", "wojtek-t", "smarterclayton", "liggitt"], 
  "name": ["Daniel Smith", "Mike Danese", "Tim Hockin", "Chao Xu", "Brendan Burns", "Dr. Stefan Schimanski", "David Eads", "Wojciech Tyczynski", "Clayton Coleman", "Jordan Liggitt"], 
  "followers": [369, 287, 1031, 382, 2007, 312, 258, 240, 1017, 537], 
  "total_commits": [720, 853, 887, 903, 1026, 1086, 1171, 1211, 1324, 1481]
}

Yearly Commit Activity

Returns total commits made each week for the last 12 months for the requested repository. Will require JSON.parse(response).

Request

GET http://githubsuccessapi-env.eba-8utmmuhi.us-east-1.elasticbeanstalk.com/visualization/yearly-commit-activity/kubernetes/kubernetes

Response

{
  "week": ["2019-08-18 00:00:00", "2019-08-25 00:00:00", "2019-09-01 00:00:00", "2019-09-08 00:00:00", "2019-09-15 00:00:00", "2019-09-22 00:00:00", "2019-09-29 00:00:00", "2019-10-06 00:00:00", "2019-10-13 00:00:00", "2019-10-20 00:00:00", "2019-10-27 00:00:00", "2019-11-03 00:00:00", "2019-11-10 00:00:00", "2019-11-17 00:00:00", "2019-11-24 00:00:00", "2019-12-01 00:00:00", "2019-12-08 00:00:00", "2019-12-15 00:00:00", "2019-12-22 00:00:00", "2019-12-29 00:00:00", "2020-01-05 00:00:00", "2020-01-12 00:00:00", "2020-01-19 00:00:00", "2020-01-26 00:00:00", "2020-02-02 00:00:00", "2020-02-09 00:00:00", "2020-02-16 00:00:00", "2020-02-23 00:00:00", "2020-03-01 00:00:00", "2020-03-08 00:00:00", "2020-03-15 00:00:00", "2020-03-22 00:00:00", "2020-03-29 00:00:00", "2020-04-05 00:00:00", "2020-04-12 00:00:00", "2020-04-19 00:00:00", "2020-04-26 00:00:00", "2020-05-03 00:00:00", "2020-05-10 00:00:00", "2020-05-17 00:00:00", "2020-05-24 00:00:00", "2020-05-31 00:00:00", "2020-06-07 00:00:00", "2020-06-14 00:00:00", "2020-06-21 00:00:00", "2020-06-28 00:00:00", "2020-07-05 00:00:00", "2020-07-12 00:00:00", "2020-07-19 00:00:00", "2020-07-26 00:00:00", "2020-08-02 00:00:00", "2020-08-09 00:00:00"], 
  "total_commits": [188, 231, 117, 110, 119, 124, 143, 184, 140, 167, 165, 239, 204, 85, 94, 129, 124, 120, 79, 71, 165, 158, 112, 99, 124, 133, 97, 155, 142, 63, 102, 163, 122, 94, 112, 130, 100, 97, 133, 99, 122, 114, 101, 107, 113, 115, 68, 45, 66, 50, 25, 39]
}

Yearly Code Frequency

Returns total additions and deletions made each month for the last 12 months for the requested repository. Will require JSON.parse(response).

Request

GET http://githubsuccessapi-env.eba-8utmmuhi.us-east-1.elasticbeanstalk.com/visualization/yearly-code-frequency/kubernetes/kubernetes

Response

{
  "week": ["2020-08-09 00:00:00", "2020-07-26 00:00:00", "2020-06-28 00:00:00", "2020-05-31 00:00:00", "2020-04-26 00:00:00", "2020-03-29 00:00:00", "2020-02-23 00:00:00", "2020-01-26 00:00:00", "2019-12-29 00:00:00", "2019-11-24 00:00:00", "2019-10-27 00:00:00", "2019-09-29 00:00:00"], 
  "additions": [9950, 1652, 7544, 51401, 12142, 34646, 28899, 56881, 8420, 6969, 133671, 16423], 
  "deletions": [-8837, -1547, -4368, -26706, -7554, -22266, -12375, -5500, -5041, -3254, -124854, -12091]
}

Daily Commits

Returns daily commits over the last week for the requested repository. Will require JSON.parse(response).

Request

GET http://githubsuccessapi-env.eba-8utmmuhi.us-east-1.elasticbeanstalk.com/visualization/daily-commits/kubernetes/kubernetes

Response

{
  "day": [
    "Sunday",
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday"
  ],
  "commits": [
    825,
    3275,
    3672,
    3871,
    3840,
    3495,
    1022
  ]
}

30 Day Issue Activity

Returns daily count of opened and closed issues over the last 30 days for the requested repository. Will require JSON.parse(response).

Request

GET http://githubsuccessapi-env.eba-8utmmuhi.us-east-1.elasticbeanstalk.com/visualization/issue-activity/30/kubernetes/kubernetes

Response

{
    "open_issues": {
        "created_at": ["2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17"], 
        "issue_count": [8, 16, 20, 26, 13, 17, 4, 2, 15, 12, 15, 21, 12, 7, 3, 12, 22, 23, 15, 27, 9, 7, 20, 25, 26, 17, 21, 9, 6, 22]
    }, 
    "closed_issues": {
        "created_at": ["2020-07-19", "2020-07-20", "2020-07-21", "2020-07-22", "2020-07-23", "2020-07-24", "2020-07-25", "2020-07-26", "2020-07-27", "2020-07-28", "2020-07-29", "2020-07-30", "2020-07-31", "2020-08-01", "2020-08-02", "2020-08-03", "2020-08-04", "2020-08-05", "2020-08-06", "2020-08-07", "2020-08-08", "2020-08-09", "2020-08-10", "2020-08-11", "2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17"], 
        "issue_count": [15, 18, 21, 31, 21, 20, 5, 4, 18, 16, 17, 21, 16, 7, 2, 14, 14, 16, 12, 10, 10, 10, 10, 14, 18, 15, 13, 4, 1, 4]
    }
}

7 Day Issue Activity

Returns daily count of opened and closed issues over the last 7 days for the requested repository. Will require JSON.parse(response).

Request

GET http://githubsuccessapi-env.eba-8utmmuhi.us-east-1.elasticbeanstalk.com/visualization/issue-activity/7/kubernetes/kubernetes

Response

{
    "open_issues": {
        "created_at": ["2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18"], 
        "issue_count": [26, 17, 21, 9, 6, 22, 17]
    }, 
    "closed_issues": {
        "created_at": ["2020-08-12", "2020-08-13", "2020-08-14", "2020-08-15", "2020-08-16", "2020-08-17", "2020-08-18"], 
        "issue_count": [18, 15, 13, 4, 1, 4, 11]
    }
}

Issue Comments

Returns all issues, their comment count, and body length for the last 7 days for the requested repository. Will require JSON.parse(response).

Request

GET http://githubsuccessapi-env.eba-8utmmuhi.us-east-1.elasticbeanstalk.com/visualization/issue-comments/kubernetes/kubernetes

Response

{
    "opened_at": ["2020-08-17 22:54:13", "2020-08-17 21:31:12", "2020-08-17 20:53:09", "2020-08-17 20:50:26", "2020-08-17 16:59:49", "2020-08-17 16:03:14", "2020-08-17 15:54:58", "2020-08-17 15:43:39", "2020-08-17 15:22:44", "2020-08-17 15:13:21", "2020-08-17 14:47:09", "2020-08-17 14:44:22", "2020-08-17 14:29:22", "2020-08-17 14:01:44", "2020-08-17 12:25:53", "2020-08-17 10:21:02", "2020-08-17 09:27:33", "2020-08-17 09:21:45", "2020-08-17 09:08:17", "2020-08-17 06:46:53", "2020-08-17 06:08:21", "2020-08-17 06:07:30", "2020-08-17 02:56:49", "2020-08-17 02:46:53", "2020-08-17 02:38:50", "2020-08-17 02:25:56", "2020-08-16 20:52:01", "2020-08-16 19:15:03", "2020-08-16 12:53:30", "2020-08-16 12:49:52", "2020-08-16 11:58:35", "2020-08-16 08:48:31", "2020-08-16 05:26:17", "2020-08-15 23:46:15", "2020-08-15 22:01:19", "2020-08-15 20:55:58", "2020-08-15 20:19:04", "2020-08-15 20:04:15", "2020-08-15 19:24:43", "2020-08-15 18:14:21", "2020-08-15 15:47:41", "2020-08-15 09:17:50", "2020-08-15 08:09:41", "2020-08-15 07:16:27", "2020-08-15 05:57:02", "2020-08-15 01:31:03", "2020-08-14 22:10:33", "2020-08-14 21:53:45", "2020-08-14 21:02:28", "2020-08-14 19:58:42", "2020-08-14 19:53:13", "2020-08-14 19:32:06", "2020-08-14 18:11:59", "2020-08-14 17:44:36", "2020-08-14 16:11:14", "2020-08-14 15:17:49", "2020-08-14 15:13:56", "2020-08-14 15:08:43", "2020-08-14 14:40:19", "2020-08-14 14:27:59", "2020-08-14 13:33:45", "2020-08-14 12:57:36", "2020-08-14 11:05:29", "2020-08-14 10:32:34", "2020-08-14 09:54:50", "2020-08-14 08:59:07", "2020-08-14 08:48:57", "2020-08-14 08:15:57", "2020-08-14 07:44:24", "2020-08-14 07:13:09", "2020-08-14 06:45:47", "2020-08-14 06:02:36", "2020-08-14 05:59:33", "2020-08-14 03:15:12", "2020-08-14 03:07:32", "2020-08-14 02:42:17", "2020-08-14 01:40:24", "2020-08-14 01:22:21", "2020-08-14 01:19:09", "2020-08-14 01:14:26", "2020-08-13 23:55:51", "2020-08-13 21:18:17", "2020-08-13 21:13:38", "2020-08-13 21:02:52", "2020-08-13 20:38:10", "2020-08-13 20:33:55", "2020-08-13 20:23:32", "2020-08-13 20:21:16", "2020-08-13 20:08:12", "2020-08-13 19:40:33", "2020-08-13 19:37:02", "2020-08-13 19:20:43", "2020-08-13 19:12:19", "2020-08-13 18:21:10", "2020-08-13 17:47:39", "2020-08-13 16:18:19", "2020-08-13 16:02:22", "2020-08-13 15:55:42", "2020-08-13 15:45:41", "2020-08-13 15:36:48", "2020-08-13 14:33:30", "2020-08-13 14:14:14", "2020-08-13 12:41:46", "2020-08-13 10:58:20", "2020-08-13 09:09:29", "2020-08-13 04:04:36", "2020-08-13 02:10:47", "2020-08-13 01:15:03", "2020-08-13 01:14:54", "2020-08-13 00:59:43", "2020-08-13 00:53:50", "2020-08-13 00:10:42", "2020-08-12 23:59:21", "2020-08-12 22:18:35", "2020-08-12 22:16:22", "2020-08-12 21:17:00", "2020-08-12 20:25:49", "2020-08-12 20:22:05", "2020-08-12 19:40:36", "2020-08-12 19:25:07", "2020-08-12 19:24:39", "2020-08-12 19:24:05", "2020-08-12 19:23:13", "2020-08-12 19:16:28", "2020-08-12 17:42:10", "2020-08-12 17:30:45", "2020-08-12 17:24:36", "2020-08-12 17:08:38", "2020-08-12 17:05:43", "2020-08-12 16:40:05", "2020-08-12 15:46:31", "2020-08-12 14:59:26", "2020-08-12 14:52:35", "2020-08-12 14:08:32", "2020-08-12 13:51:26", "2020-08-12 13:22:27", "2020-08-12 13:05:06", "2020-08-12 12:58:38", "2020-08-12 12:46:35", "2020-08-12 12:38:05", "2020-08-12 12:08:06", "2020-08-12 10:35:26", "2020-08-12 10:34:32", "2020-08-12 09:58:55", "2020-08-12 07:46:13", "2020-08-12 06:56:50", "2020-08-12 03:36:57", "2020-08-12 03:24:12", "2020-08-12 03:19:16", "2020-08-12 02:39:37", "2020-08-12 02:28:57", "2020-08-12 02:19:01", "2020-08-12 01:51:37", "2020-08-12 01:49:45", "2020-08-12 01:35:41", "2020-08-12 00:12:48", "2020-08-11 21:55:47", "2020-08-11 21:36:13", "2020-08-11 21:17:48", "2020-08-11 20:54:14", "2020-08-11 20:23:54", "2020-08-11 19:44:23", "2020-08-11 19:43:47", "2020-08-11 19:40:25", "2020-08-11 19:26:15", "2020-08-11 18:54:48", "2020-08-11 18:48:25", "2020-08-11 18:27:41", "2020-08-11 18:21:18", "2020-08-11 18:07:01", "2020-08-11 17:38:44", "2020-08-11 17:18:53", "2020-08-11 16:48:41", "2020-08-11 15:39:31", "2020-08-11 15:24:36", "2020-08-11 14:38:01", "2020-08-11 14:04:34", "2020-08-11 13:24:51", "2020-08-11 13:06:38", "2020-08-11 13:02:09", "2020-08-11 12:41:21", "2020-08-11 12:38:39", "2020-08-11 11:04:40", "2020-08-11 11:03:04", "2020-08-11 10:54:30", "2020-08-11 10:36:31", "2020-08-11 09:17:58", "2020-08-11 09:15:47", "2020-08-11 09:12:05", "2020-08-11 09:04:36", "2020-08-11 06:12:19", "2020-08-11 04:11:19", "2020-08-11 03:21:33", "2020-08-11 03:17:54", "2020-08-11 01:09:45"], 
    "total_comments": [2, 2, 4, 4, 3, 1, 8, 5, 6, 3, 4, 5, 6, 5, 10, 11, 4, 4, 4, 4, 3, 3, 5, 6, 9, 8, 5, 3, 6, 22, 4, 8, 4, 3, 30, 7, 4, 8, 5, 5, 8, 7, 2, 1, 9, 1, 7, 3, 6, 3, 4, 2, 12, 6, 8, 1, 0, 2, 9, 5, 9, 9, 3, 3, 1, 5, 11, 5, 10, 3, 2, 6, 4, 3, 1, 4, 6, 5, 1, 9, 11, 4, 10, 12, 7, 1, 9, 6, 8, 3, 5, 5, 10, 3, 8, 14, 7, 5, 5, 8, 5, 12, 14, 5, 5, 6, 5, 2, 5, 14, 4, 2, 7, 6, 7, 22, 3, 7, 4, 5, 7, 8, 12, 4, 8, 23, 14, 3, 10, 3, 5, 5, 1, 3, 7, 3, 6, 6, 7, 5, 3, 10, 7, 3, 10, 5, 9, 11, 3, 16, 4, 1, 2, 17, 11, 9, 4, 10, 5, 3, 1, 5, 6, 2, 3, 13, 6, 6, 3, 8, 6, 11, 2, 13, 9, 15, 2, 2, 16, 3, 9, 11, 6, 14, 3, 8, 11, 5, 1, 4, 4, 3, 8, 3, 11], 
    "body_length": [1825, 1226, 43, 1567, 463, 4454, 3301, 1981, 399, 525, 448, 2211, 1006, 434, 3388, 216, 108, 108, 108, 3266, 253, 253, 339, 341, 4900, 310, 1254, 1004, 3128, 3049, 3964, 1450, 3786, 1807, 12337, 1222, 38, 34, 474, 2135, 4133, 1976, 1296, 2552, 1661, 458, 1266, 345, 1584, 691, 3050, 638, 431, 1491, 964, 638, 1540, 989, 1374, 2431, 1606, 198, 1399, 1968, 263, 2093, 3088, 3069, 2333, 1903, 1958, 3349, 713, 1628, 777, 1055, 3213, 3049, 711, 1737, 1654, 1150, 3114, 3183, 334, 329, 235, 235, 3203, 518, 9664, 579, 2963, 1493, 225, 1068, 382, 583, 375, 321, 4201, 3555, 3110, 3083, 745, 4623, 2894, 979, 979, 2275, 979, 3162, 488, 3507, 434, 3063, 790, 484, 6295, 237, 297, 297, 296, 756, 995, 1107, 1857, 2828, 421, 602, 3163, 1048, 2868, 407, 750, 622, 2380, 3469, 4675, 2380, 1660, 5137, 3835, 3858, 3136, 3941, 3948, 2181, 413, 3895, 1595, 283, 686, 238, 3017, 842, 714, 721, 1177, 1419, 3775, 2171, 694, 425, 2531, 494, 1234, 495, 3387, 1288, 485, 692, 952, 22231, 4847, 3105, 3076, 4876, 1367, 429, 925, 1379, 3074, 4351, 495, 124, 1356, 1701, 182, 717, 850, 1225, 3097, 83, 3461]
}

About

πŸ“Š API serving data formatted to be used with a visualization library such as Plotly.js

Resources

License

Stars

Watchers

Forks