Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Commite0389e5

Browse files
author
Hubot
committed
Sync changes from upstream repository
1 parent084e21e commite0389e5

File tree

4 files changed

+194
-0
lines changed

4 files changed

+194
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title:Preview the Repository Traffic API
3+
author_name:shreyasjoshis
4+
---
5+
6+
We've added an API for repository traffic, which will let you fetch details about traffic for repositories you have push access to. This data is already available in graphical form in the[Graphs section](https://help.github.com/articles/about-repository-graphs/#traffic) on GitHub.com.
7+
8+
To access[the Traffic API][docs] during the preview period, you must provide a custom[media type][media-type] in the`Accept` header:
9+
10+
application/vnd.github.spiderman-preview
11+
12+
During the preview period, we may change aspects of these API methods based on developer feedback. If we do, we will announce the changes here on the developer blog, but we will not provide any advance notice.
13+
14+
If you have any questions or feedback, please[let us know][contact]!
15+
16+
[media-type]:/v3/media
17+
[docs]:/v3/repos/traffic/
18+
[contact]:https://github.com/contact?form%5Bsubject%5D=Traffic+API

‎content/v3/repos/traffic.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title:Traffic
3+
---
4+
5+
#Traffic
6+
{{#tip}}
7+
8+
<aname="preview-period"></a>
9+
10+
APIs for repository traffic are currently available for developers to preview.
11+
During the preview period, the APIs may change without advance notice.
12+
Please see the[blog post](/changes/2016-08-15-traffic-api-preview) for full details.
13+
14+
To access the API you must provide a custom[media type](/v3/media) in the`Accept` header:
15+
16+
application/vnd.github.spiderman-preview
17+
18+
{{/tip}}
19+
20+
{:toc}
21+
22+
For repositories that you have push access to, the traffic API provides access
23+
to the information provided in the[graphs section](https://help.github.com/articles/about-repository-graphs/#traffic).
24+
25+
<aid="list" />
26+
27+
##List referrers
28+
29+
Get the top 10 referrers over the last 14 days.
30+
31+
GET /repos/:owner/:repo/traffic/popular/referrers
32+
33+
###Response
34+
35+
<%= headers 200 %>
36+
<%= json(:traffic_referrers) %>
37+
38+
##List paths
39+
40+
Get the top 10 popular contents over the last 14 days.
41+
42+
GET /repos/:owner/:repo/traffic/popular/paths
43+
44+
###Response
45+
46+
<%= headers 200%>
47+
<%= json(:traffic_contents) %>
48+
49+
##Views
50+
51+
Get the total number of views and breakdown per day or week for the last 14 days.
52+
53+
GET /repos/:owner/:repo/traffic/views
54+
55+
###Parameters
56+
Name | Type | Description
57+
-----|------|--------------
58+
`per`|string|Must be one of:`day`,`week`. Default:`day`
59+
60+
61+
###Response
62+
<%= headers 200 %>
63+
<%= json(:traffic_views) %>
64+
65+
##Clones
66+
67+
Get the total number of clones and breakdown per day or week for the last 14 days.
68+
69+
GET /repos/:owner/:repo/traffic/clones
70+
71+
###Parameters
72+
Name | Type | Description
73+
-----|------|--------------
74+
`per`|string|Must be one of:`day`,`week`. Default:`day`
75+
76+
###Response
77+
78+
<%= headers 200 %>
79+
<%= json(:traffic_clones) %>

‎layouts/sidebar.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ <h3><a href="#" class="js-expand-btn collapsed arrow-btn" data-proofer-ignore></
118118
<li><ahref="/v3/repos/releases/">Releases</a></li>
119119
<li><ahref="/v3/repos/statistics/">Statistics</a></li>
120120
<li><ahref="/v3/repos/statuses/">Statuses</a></li>
121+
<% if @item[:version] == 'dotcom' %>
122+
<li><ahref="/v3/repos/traffic/">Traffic</a></li>
123+
<% end %>
121124
<li><ahref="/v3/repos/hooks/">Webhooks</a></li>
122125
<% if @item[:version].is_a?(Numeric) && @item[:version]>= 2.7 %>
123126
<li><ahref="/v3/repos/pre_receive_hooks/">Pre-receive Hooks (Enterprise)</a></li>

‎lib/responses/traffic.rb

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
moduleGitHub
2+
moduleResources
3+
moduleResponses
4+
5+
TRAFFIC_REFERRERS ||=[
6+
{"referrer"=>"Google","count"=>4,"uniques"=>3},
7+
{"referrer"=>"stackoverflow.com","count"=>2,"uniques"=>2},
8+
{"referrer"=>"eggsonbread.com","count"=>1,"uniques"=>1},
9+
{"referrer"=>"yandex.ru","count"=>1,"uniques"=>1}]
10+
11+
TRAFFIC_CONTENTS ||=[
12+
{
13+
"path"=>"/github/hubot",
14+
"title"=>"github/hubot: A customizable life embetterment robot.",
15+
"count"=>3542,
16+
"uniques"=>2225
17+
},
18+
{
19+
"path"=>"/github/hubot/blob/master/docs/scripting.md",
20+
"title"=>"hubot/scripting.md at master · github/hubot · GitHub",
21+
"count"=>1707,
22+
"uniques"=>804
23+
},
24+
{
25+
"path"=>"/github/hubot/tree/master/docs",
26+
"title"=>"hubot/docs at master · github/hubot · GitHub",
27+
"count"=>685,
28+
"uniques"=>435
29+
},
30+
{
31+
"path"=>"/github/hubot/tree/master/src",
32+
"title"=>"hubot/src at master · github/hubot · GitHub",
33+
"count"=>577,
34+
"uniques"=>347
35+
},
36+
{
37+
"path"=>"/github/hubot/blob/master/docs/index.md",
38+
"title"=>"hubot/index.md at master · github/hubot · GitHub",
39+
"count"=>379,
40+
"uniques"=>259
41+
},
42+
{
43+
"path"=>"/github/hubot/blob/master/docs/adapters.md",
44+
"title"=>"hubot/adapters.md at master · github/hubot · GitHub",
45+
"count"=>354,
46+
"uniques"=>201
47+
},
48+
{
49+
"path"=>"/github/hubot/tree/master/examples",
50+
"title"=>"hubot/examples at master · github/hubot · GitHub",
51+
"count"=>340,
52+
"uniques"=>260
53+
},
54+
{
55+
"path"=>"/github/hubot/blob/master/docs/deploying/heroku.md",
56+
"title"=>"hubot/heroku.md at master · github/hubot · GitHub",
57+
"count"=>324,
58+
"uniques"=>217
59+
},
60+
{
61+
"path"=>"/github/hubot/blob/master/src/robot.coffee",
62+
"title"=>"hubot/robot.coffee at master · github/hubot · GitHub",
63+
"count"=>293,
64+
"uniques"=>191
65+
},
66+
{
67+
"path"=>"/github/hubot/blob/master/LICENSE.md",
68+
"title"=>"hubot/LICENSE.md at master · github/hubot · GitHub",
69+
"count"=>281,
70+
"uniques"=>222
71+
}]
72+
73+
TRAFFIC_VIEWS ||={
74+
"count"=>7,
75+
"uniques"=>6,
76+
"views"=>[
77+
{"timestamp"=>1464710400000,"count"=>1,"uniques"=>1},
78+
{"timestamp"=>1464732000000,"count"=>2,"uniques"=>1},
79+
{"timestamp"=>1465214400000,"count"=>1,"uniques"=>1},
80+
{"timestamp"=>1465218000000,"count"=>1,"uniques"=>1},
81+
{"timestamp"=>1465300800000,"count"=>2,"uniques"=>2}]}
82+
83+
TRAFFIC_CLONES ||={
84+
"count"=>7,
85+
"uniques"=>6,
86+
"clones"=>[
87+
{"timestamp"=>1464710400000,"count"=>1,"uniques"=>1},
88+
{"timestamp"=>1464732000000,"count"=>2,"uniques"=>1},
89+
{"timestamp"=>1465214400000,"count"=>1,"uniques"=>1},
90+
{"timestamp"=>1465218000000,"count"=>1,"uniques"=>1},
91+
{"timestamp"=>1465300800000,"count"=>2,"uniques"=>2}]}
92+
end
93+
end
94+
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp