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.

Commite52945b

Browse files
committed
Merge pull request#728 from github/licenses-api
Licenses API documentation
2 parentsc464520 +506312d commite52945b

File tree

4 files changed

+224
-0
lines changed

4 files changed

+224
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
kind:change
3+
title:Licenses API
4+
created_at:2015-03-09
5+
author_name:benbalter
6+
---
7+
8+
We're introducing a new[license API](/v3/licenses) preview to support[open source license usage on GitHub.com](https://github.com/blog/1964-license-usage-on-github-com).
9+
10+
To access the API during the preview period, you must provide a custom[media type](/v3/media) in the`Accept` header:
11+
12+
application/vnd.github.drax-preview+json
13+
14+
This will then expose two new API endpoints. You can get a list of all known licenses:
15+
16+
GET /licenses
17+
18+
Or get information about a particular license:
19+
20+
GET /licenses/mit
21+
22+
When the preview media type is passed, the repository api will also return information about a repository's license file when you get an individual repository:
23+
24+
GET /repos/github/hubot
25+
26+
For more information, see the[licenses API documentation](/v3/licenses/), and if you have any questions or feedback, please[let us know](https://github.com/contact?form%5Bsubject%5D=Licenses+API).

‎content/v3/licenses.md‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
title:Licenses | GitHub API
3+
---
4+
5+
#Licenses
6+
7+
* TOC
8+
{:toc}
9+
10+
{{#tip}}
11+
12+
<aname="preview-period"></a>
13+
14+
The Licenses API is currently available for developers to preview.
15+
During the preview period, the API may change without advance notice.
16+
Please see the[blog post][https://github.com/blog/1964-open-source-license-usage-on-github-com] for full details.
17+
18+
To access the API during the preview period, you must provide a custom[media type](/v3/media) in the`Accept` header:
19+
20+
application/vnd.github.drax-preview+json
21+
22+
{{/tip}}
23+
24+
The Licenses API returns metadata about popular open source licenses and information about a particular project's license file. The license key and name conforms to the[SPDX specification](https://spdx.org/).
25+
26+
{{#warning}}
27+
28+
GitHub is a lot of things, but it’s not a law firm. As such, GitHub does not provide legal advice. Using the Licenses API or sending us an email about it does not constitute legal advice nor does it create an attorney-client relationship. If you have any questions about what you can and can't do with a particular license, you should consult with your own legal counsel before moving forward. In fact, you should always consult with your own lawyer before making any decisions that might have legal ramifications or that may impact your legal rights.
29+
30+
GitHub created the License API to help users get information about open source licenses and the projects that use them. We hope it helps, but please keep in mind that we’re not lawyers (at least not most of us aren't) and that we make mistakes like everyone else. For that reason, GitHub provides the API on an “as-is” basis and makes no warranties regarding any information or licenses provided on or through it, and disclaims liability for damages resulting from using the API.
31+
32+
{{/warning}}
33+
34+
##List all licenses
35+
36+
GET /licenses
37+
38+
###Response
39+
40+
<%= headers 200 %>
41+
<%= json(:licenses) %>
42+
43+
##Get an individual license
44+
45+
GET /licenses/mit
46+
47+
###Response
48+
49+
<%= headers 200 %>
50+
<%= json(:mit) %>
51+
52+
##Get a repository's license
53+
54+
When passed the preview media type, requests to get a repository will also return the repository's license, if it can be detected from the repository's license file.
55+
56+
It's important to note that the API simply attempts to identity the project's license by the contents of the a`LICENSE` file, if any, and does not take into account the licenses of project dependencies or other means of documenting a project's license such as references in the documentation.
57+
58+
GET /repos/github/hubot
59+
60+
###Response
61+
62+
<%= headers 200 %>
63+
<%= json(:licensee) %>

‎content/v3/misc.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ organization's [GitHub Enterprise](https://enterprise.github.com/) installation.
3030
The[Rate Limit API][Rate Limit] lets you check your current rate limit
3131
status at any time.
3232

33+
##[Licenses][]
34+
35+
The[Licenses API][Licenses] returns information about open source licenses or under what license, if any a given project is distributed.
36+
3337
[Emojis]:/v3/emojis
3438
[Gitignore]:/v3/gitignore
3539
[Markdown]:/v3/markdown
3640
[Meta]:/v3/meta
3741
[Rate Limit]:/v3/rate_limit
42+
[Licenses]:/v3/licenses

‎lib/resources.rb‎

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,6 +2307,136 @@ def fetch_content(key)
23072307
LDAP_SYNC_CONFIRM ||={
23082308
'status'=>'queued'
23092309
}
2310+
2311+
LICENSES ||=[
2312+
{"key"=>"agpl-3.0","name"=>"GNU Affero GPL v3.0","url"=>"https://api.github.com/licenses/agpl-3.0"},
2313+
{"key"=>"apache-2.0","name"=>"Apache License 2.0","url"=>"https://api.github.com/licenses/apache-2.0"},
2314+
{"key"=>"artistic-2.0","name"=>"Artistic License 2.0","url"=>"https://api.github.com/licenses/artistic-2.0"},
2315+
{"key"=>"bsd-2-clause","name"=>"Simplified BSD","url"=>"https://api.github.com/licenses/bsd-2-clause"},
2316+
{"key"=>"bsd-3-clause","name"=>"New BSD","url"=>"https://api.github.com/licenses/bsd-3-clause"},
2317+
{"key"=>"cc0","name"=>"CC0 1.0 Universal","url"=>"https://api.github.com/licenses/cc0"},
2318+
{"key"=>"epl-1.0","name"=>"Eclipse Public License v1.0","url"=>"https://api.github.com/licenses/epl-1.0"},
2319+
{"key"=>"gpl-2.0","name"=>"GNU GPL v2.0","url"=>"https://api.github.com/licenses/gpl-2.0"},
2320+
{"key"=>"gpl-3.0","name"=>"GNU GPL v3.0","url"=>"https://api.github.com/licenses/gpl-3.0"},
2321+
{"key"=>"isc","name"=>"ISC license","url"=>"https://api.github.com/licenses/isc"},
2322+
{"key"=>"lgpl-2.1","name"=>"GNU LGPL v2.1","url"=>"https://api.github.com/licenses/lgpl-2.1"},
2323+
{"key"=>"lgpl-3.0","name"=>"GNU LGPL v3.0","url"=>"https://api.github.com/licenses/lgpl-3.0"},
2324+
{"key"=>"mit","name"=>"MIT License","url"=>"https://api.github.com/licenses/mit"},
2325+
{"key"=>"mpl-2.0","name"=>"Mozilla Public License 2.0","url"=>"https://api.github.com/licenses/mpl-2.0"},
2326+
{"key"=>"unlicense","name"=>"Public Domain (Unlicense)","url"=>"https://api.github.com/licenses/unlicense"}
2327+
]
2328+
2329+
MIT ||={
2330+
"key"=>"mit",
2331+
"name"=>"MIT License",
2332+
"url"=>"https://api.github.com/licenses/mit",
2333+
"html_url"=>"http://choosealicense.com/licenses/mit/",
2334+
"featured"=>true,
2335+
"description"=>"A permissive license that is short and to the point. It lets people do anything with your code with proper attribution and without warranty.",
2336+
"category"=>"MIT",
2337+
"implementation"=>
2338+
"Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders.",
2339+
"required"=>["include-copyright"],
2340+
"permitted"=>["commercial-use","modifications","distribution","sublicense","private-use"],
2341+
"forbidden"=>["no-liability"],
2342+
"body"=>
2343+
"\n\nThe MIT License (MIT)\n\nCopyright (c) [year] [fullname]\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the\"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED\"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
2344+
}
2345+
2346+
LICENSEE ||={
2347+
"id"=>23022377,
2348+
"name"=>"licensee",
2349+
"full_name"=>"benbalter/licensee",
2350+
"owner"=>{
2351+
"login"=>"benbalter",
2352+
"id"=>282759,
2353+
"avatar_url"=>"https://avatars.githubusercontent.com/u/282759?v=3",
2354+
"gravatar_id"=>"",
2355+
"url"=>"https://api.github.com/users/benbalter",
2356+
"html_url"=>"https://github.com/benbalter",
2357+
"followers_url"=>"https://api.github.com/users/benbalter/followers",
2358+
"following_url"=>"https://api.github.com/users/benbalter/following{/other_user}",
2359+
"gists_url"=>"https://api.github.com/users/benbalter/gists{/gist_id}",
2360+
"starred_url"=>"https://api.github.com/users/benbalter/starred{/owner}{/repo}",
2361+
"subscriptions_url"=>"https://api.github.com/users/benbalter/subscriptions",
2362+
"organizations_url"=>"https://api.github.com/users/benbalter/orgs",
2363+
"repos_url"=>"https://api.github.com/users/benbalter/repos",
2364+
"events_url"=>"https://api.github.com/users/benbalter/events{/privacy}",
2365+
"received_events_url"=>"https://api.github.com/users/benbalter/received_events",
2366+
"type"=>"User",
2367+
"site_admin"=>true
2368+
},
2369+
"private"=>false,
2370+
"html_url"=>"https://github.com/benbalter/licensee",
2371+
"description"=>"A Ruby Gem to detect under what license a project is distributed.",
2372+
"fork"=>false,"url"=>"https://api.github.com/repos/benbalter/licensee",
2373+
"forks_url"=>"https://api.github.com/repos/benbalter/licensee/forks",
2374+
"keys_url"=>"https://api.github.com/repos/benbalter/licensee/keys{/key_id}",
2375+
"collaborators_url"=>"https://api.github.com/repos/benbalter/licensee/collaborators{/collaborator}",
2376+
"teams_url"=>"https://api.github.com/repos/benbalter/licensee/teams",
2377+
"hooks_url"=>"https://api.github.com/repos/benbalter/licensee/hooks",
2378+
"issue_events_url"=>"https://api.github.com/repos/benbalter/licensee/issues/events{/number}",
2379+
"events_url"=>"https://api.github.com/repos/benbalter/licensee/events",
2380+
"assignees_url"=>"https://api.github.com/repos/benbalter/licensee/assignees{/user}",
2381+
"branches_url"=>"https://api.github.com/repos/benbalter/licensee/branches{/branch}",
2382+
"tags_url"=>"https://api.github.com/repos/benbalter/licensee/tags",
2383+
"blobs_url"=>"https://api.github.com/repos/benbalter/licensee/git/blobs{/sha}",
2384+
"git_tags_url"=>"https://api.github.com/repos/benbalter/licensee/git/tags{/sha}",
2385+
"git_refs_url"=>"https://api.github.com/repos/benbalter/licensee/git/refs{/sha}",
2386+
"trees_url"=>"https://api.github.com/repos/benbalter/licensee/git/trees{/sha}",
2387+
"statuses_url"=>"https://api.github.com/repos/benbalter/licensee/statuses/{sha}",
2388+
"languages_url"=>"https://api.github.com/repos/benbalter/licensee/languages",
2389+
"stargazers_url"=>"https://api.github.com/repos/benbalter/licensee/stargazers",
2390+
"contributors_url"=>"https://api.github.com/repos/benbalter/licensee/contributors",
2391+
"subscribers_url"=>"https://api.github.com/repos/benbalter/licensee/subscribers",
2392+
"subscription_url"=>"https://api.github.com/repos/benbalter/licensee/subscription",
2393+
"commits_url"=>"https://api.github.com/repos/benbalter/licensee/commits{/sha}",
2394+
"git_commits_url"=>"https://api.github.com/repos/benbalter/licensee/git/commits{/sha}",
2395+
"comments_url"=>"https://api.github.com/repos/benbalter/licensee/comments{/number}",
2396+
"issue_comment_url"=>"https://api.github.com/repos/benbalter/licensee/issues/comments{/number}",
2397+
"contents_url"=>"https://api.github.com/repos/benbalter/licensee/contents/{+path}",
2398+
"compare_url"=>"https://api.github.com/repos/benbalter/licensee/compare/{base}...{head}",
2399+
"merges_url"=>"https://api.github.com/repos/benbalter/licensee/merges",
2400+
"archive_url"=>"https://api.github.com/repos/benbalter/licensee/{archive_format}{/ref}",
2401+
"downloads_url"=>"https://api.github.com/repos/benbalter/licensee/downloads",
2402+
"issues_url"=>"https://api.github.com/repos/benbalter/licensee/issues{/number}",
2403+
"pulls_url"=>"https://api.github.com/repos/benbalter/licensee/pulls{/number}",
2404+
"milestones_url"=>"https://api.github.com/repos/benbalter/licensee/milestones{/number}",
2405+
"notifications_url"=>"https://api.github.com/repos/benbalter/licensee/notifications{?since,all,participating}",
2406+
"labels_url"=>"https://api.github.com/repos/benbalter/licensee/labels{/name}",
2407+
"releases_url"=>"https://api.github.com/repos/benbalter/licensee/releases{/id}",
2408+
"created_at"=>"2014-08-16T16:39:56Z",
2409+
"updated_at"=>"2015-02-26T18:58:36Z",
2410+
"pushed_at"=>"2015-02-26T19:09:18Z",
2411+
"git_url"=>"git://github.com/benbalter/licensee.git",
2412+
"ssh_url"=>"git@github.com:benbalter/licensee.git",
2413+
"clone_url"=>"https://github.com/benbalter/licensee.git",
2414+
"svn_url"=>"https://github.com/benbalter/licensee",
2415+
"homepage"=>"",
2416+
"size"=>687,
2417+
"stargazers_count"=>20,
2418+
"watchers_count"=>20,
2419+
"language"=>"Ruby",
2420+
"has_issues"=>true,
2421+
"has_downloads"=>true,
2422+
"has_wiki"=>false,
2423+
"has_pages"=>false,
2424+
"forks_count"=>6,
2425+
"mirror_url"=>nil,
2426+
"open_issues_count"=>2,
2427+
"forks"=>6,
2428+
"open_issues"=>2,
2429+
"watchers"=>20,
2430+
"default_branch"=>"master",
2431+
"master_branch"=>"master",
2432+
"license"=>{
2433+
"key"=>"mit",
2434+
"name"=>"MIT License",
2435+
"url"=>"https://api.github.com/licenses/mit"
2436+
},
2437+
"network_count"=>6,
2438+
"subscribers_count"=>6
2439+
}
23102440
end
23112441
end
23122442

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp