Skip to main content
이제 REST API의 버전이 지정되었습니다. 자세한 내용은 "API 버전 관리 정보"를 참조하세요.

라이선스에 대한 REST API 엔드포인트

REST API를 사용하여 인기 있는 오픈 소스 라이선스와 특정 프로젝트의 라이선스 파일에 대한 정보를 검색합니다.

라이선스 정보

GitHub은(는) 오픈 소스 Ruby 보석라이선스 실시권자를 통해 프로젝트의 라이선스를 식별하려고 시도합니다. 라이선스 실시권자는 프로젝트 LICENSE 파일의 콘텐츠(있는 경우)를 알려진 라이선스의 짧은 목록과 일치합니다. 따라서 API는 프로젝트 종속성의 라이선스 또는 설명서의 라이선스 이름에 대한 참조와 같은 프로젝트 라이선스를 문서화하는 다른 방법을 고려하지 않습니다.

라이선스가 일치하는 경우 반환되는 라이선스 키와 이름은 SPDX 사양을 준수합니다.

참고: 다음과 같은 엔드포인트는 리포지토리의 라이선스 정보도 반환합니다.

GitHub는 많은 기능을 제공하지만 법률 회사가 아닙니다. 따라서 GitHub은(는) 법률 자문을 제공하지 않습니다. API를 사용하거나 이에 대한 메일을 보내는 것은 법률 자문을 구성하지 않으며 변호사와 클라이언트 관계를 만들지 않습니다. 특정 라이선스로 수행할 수 있는 작업과 수행할 수 없는 사항에 대한 질문이 있는 경우 진행하기 전에 자신의 법률 고문과 상의해야 합니다. 법적 파급 효과가 있거나 법적 권리에 영향을 미칠 수 있는 결정을 내리기 전에 항상 자신의 변호사와 상의해야 합니다.

GitHub은(는) 사용자가 오픈 소스 라이선스 및 이를 사용하는 프로젝트에 대한 정보를 얻을 수 있도록 이러한 엔드포인트를 만들었습니다. 그것이 도움이 되기를 바라지만 당사는 변호사가 아니며(적어도 우리 대부분은 그렇지 않음) 모든 사람들과 같이 실수할 수 있다는 것을 명심하시기 바랍니다. 해당 이유로 GitHub은(는) “있는 그대로” API를 제공하고 이를 통하거나 이에 제공된 정보 또는 라이선스에 대한 보증을 하지 않으며 API 사용으로 인한 손해에 대한 책임을 부인합니다.

Get all commonly used licenses

Lists the most commonly used licenses on GitHub. For more information, see "Licensing a repository ."

"Get all commonly used licenses"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 토큰 형식에서 작동합니다.:

토큰에 어떤 권한도 필요하지 않습니다.

공용 리소스만 요청되는 경우 인증 없이 이 엔드포인트를 사용할 수 있습니다.

"Get all commonly used licenses"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

Setting to application/vnd.github+json is recommended.

쿼리 매개 변수
이름, Type, 설명
featured boolean
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

기본값: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

기본값: 1

"Get all commonly used licenses"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

304

Not modified

"Get all commonly used licenses"에 대한 코드 샘플

요청 예제

get/licenses
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/licenses

Response

Status: 200
[ { "key": "mit", "name": "MIT License", "spdx_id": "MIT", "url": "https://api.github.com/licenses/mit", "node_id": "MDc6TGljZW5zZW1pdA==" }, { "key": "lgpl-3.0", "name": "GNU Lesser General Public License v3.0", "spdx_id": "LGPL-3.0", "url": "https://api.github.com/licenses/lgpl-3.0", "node_id": "MDc6TGljZW5zZW1pdA==" }, { "key": "mpl-2.0", "name": "Mozilla Public License 2.0", "spdx_id": "MPL-2.0", "url": "https://api.github.com/licenses/mpl-2.0", "node_id": "MDc6TGljZW5zZW1pdA==" }, { "key": "agpl-3.0", "name": "GNU Affero General Public License v3.0", "spdx_id": "AGPL-3.0", "url": "https://api.github.com/licenses/agpl-3.0", "node_id": "MDc6TGljZW5zZW1pdA==" }, { "key": "unlicense", "name": "The Unlicense", "spdx_id": "Unlicense", "url": "https://api.github.com/licenses/unlicense", "node_id": "MDc6TGljZW5zZW1pdA==" }, { "key": "apache-2.0", "name": "Apache License 2.0", "spdx_id": "Apache-2.0", "url": "https://api.github.com/licenses/apache-2.0", "node_id": "MDc6TGljZW5zZW1pdA==" }, { "key": "gpl-3.0", "name": "GNU General Public License v3.0", "spdx_id": "GPL-3.0", "url": "https://api.github.com/licenses/gpl-3.0", "node_id": "MDc6TGljZW5zZW1pdA==" } ]

Get a license

Gets information about a specific license. For more information, see "Licensing a repository ."

"Get a license"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 토큰 형식에서 작동합니다.:

토큰에 어떤 권한도 필요하지 않습니다.

공용 리소스만 요청되는 경우 인증 없이 이 엔드포인트를 사용할 수 있습니다.

"Get a license"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
이름, Type, 설명
license string Required

"Get a license"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

304

Not modified

403

Forbidden

404

Resource not found

"Get a license"에 대한 코드 샘플

요청 예제

get/licenses/{license}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/licenses/LICENSE

Response

Status: 200
{ "key": "mit", "name": "MIT License", "spdx_id": "MIT", "url": "https://api.github.com/licenses/mit", "node_id": "MDc6TGljZW5zZW1pdA==", "html_url": "http://choosealicense.com/licenses/mit/", "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.", "implementation": "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.", "permissions": [ "commercial-use", "modifications", "distribution", "sublicense", "private-use" ], "conditions": [ "include-copyright" ], "limitations": [ "no-liability" ], "body": "\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", "featured": true }

Get the license for a repository

This method returns the contents of the repository's license file, if one is detected.

This endpoint supports the following custom media types. For more information, see "Media types."

  • application/vnd.github.raw+json: Returns the raw contents of the license.
  • application/vnd.github.html+json: Returns the license contents in HTML. Markup languages are rendered to HTML using GitHub's open-source Markup library.

"Get the license for a repository"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 토큰 형식에서 작동합니다.:

토큰에 다음 권한 집합이 있어야 합니다.:

  • metadata:read

공용 리소스만 요청되는 경우 인증 또는 앞서 언급한 권한 없이 이 엔드포인트를 사용할 수 있습니다.

"Get the license for a repository"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
이름, Type, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

쿼리 매개 변수
이름, Type, 설명
ref string

The Git reference for the results you want to list. The ref for a branch can be formatted either as refs/heads/<branch name> or simply <branch name>. To reference a pull request use refs/pull/<number>/merge.

"Get the license for a repository"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

404

Resource not found

"Get the license for a repository"에 대한 코드 샘플

요청 예제

get/repos/{owner}/{repo}/license
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/license

Response

Status: 200
{ "name": "LICENSE", "path": "LICENSE", "sha": "401c59dcc4570b954dd6d345e76199e1f4e76266", "size": 1077, "url": "https://api.github.com/repos/benbalter/gman/contents/LICENSE?ref=master", "html_url": "https://github.com/benbalter/gman/blob/master/LICENSE", "git_url": "https://api.github.com/repos/benbalter/gman/git/blobs/401c59dcc4570b954dd6d345e76199e1f4e76266", "download_url": "https://raw.githubusercontent.com/benbalter/gman/master/LICENSE?lab=true", "type": "file", "content": "VGhlIE1JVCBMaWNlbnNlIChNSVQpCgpDb3B5cmlnaHQgKGMpIDIwMTMgQmVu\nIEJhbHRlcgoKUGVybWlzc2lvbiBpcyBoZXJlYnkgZ3JhbnRlZCwgZnJlZSBv\nZiBjaGFyZ2UsIHRvIGFueSBwZXJzb24gb2J0YWluaW5nIGEgY29weSBvZgp0\naGlzIHNvZnR3YXJlIGFuZCBhc3NvY2lhdGVkIGRvY3VtZW50YXRpb24gZmls\nZXMgKHRoZSAiU29mdHdhcmUiKSwgdG8gZGVhbCBpbgp0aGUgU29mdHdhcmUg\nd2l0aG91dCByZXN0cmljdGlvbiwgaW5jbHVkaW5nIHdpdGhvdXQgbGltaXRh\ndGlvbiB0aGUgcmlnaHRzIHRvCnVzZSwgY29weSwgbW9kaWZ5LCBtZXJnZSwg\ncHVibGlzaCwgZGlzdHJpYnV0ZSwgc3VibGljZW5zZSwgYW5kL29yIHNlbGwg\nY29waWVzIG9mCnRoZSBTb2Z0d2FyZSwgYW5kIHRvIHBlcm1pdCBwZXJzb25z\nIHRvIHdob20gdGhlIFNvZnR3YXJlIGlzIGZ1cm5pc2hlZCB0byBkbyBzbywK\nc3ViamVjdCB0byB0aGUgZm9sbG93aW5nIGNvbmRpdGlvbnM6CgpUaGUgYWJv\ndmUgY29weXJpZ2h0IG5vdGljZSBhbmQgdGhpcyBwZXJtaXNzaW9uIG5vdGlj\nZSBzaGFsbCBiZSBpbmNsdWRlZCBpbiBhbGwKY29waWVzIG9yIHN1YnN0YW50\naWFsIHBvcnRpb25zIG9mIHRoZSBTb2Z0d2FyZS4KClRIRSBTT0ZUV0FSRSBJ\nUyBQUk9WSURFRCAiQVMgSVMiLCBXSVRIT1VUIFdBUlJBTlRZIE9GIEFOWSBL\nSU5ELCBFWFBSRVNTIE9SCklNUExJRUQsIElOQ0xVRElORyBCVVQgTk9UIExJ\nTUlURUQgVE8gVEhFIFdBUlJBTlRJRVMgT0YgTUVSQ0hBTlRBQklMSVRZLCBG\nSVRORVNTCkZPUiBBIFBBUlRJQ1VMQVIgUFVSUE9TRSBBTkQgTk9OSU5GUklO\nR0VNRU5ULiBJTiBOTyBFVkVOVCBTSEFMTCBUSEUgQVVUSE9SUyBPUgpDT1BZ\nUklHSFQgSE9MREVSUyBCRSBMSUFCTEUgRk9SIEFOWSBDTEFJTSwgREFNQUdF\nUyBPUiBPVEhFUiBMSUFCSUxJVFksIFdIRVRIRVIKSU4gQU4gQUNUSU9OIE9G\nIENPTlRSQUNULCBUT1JUIE9SIE9USEVSV0lTRSwgQVJJU0lORyBGUk9NLCBP\nVVQgT0YgT1IgSU4KQ09OTkVDVElPTiBXSVRIIFRIRSBTT0ZUV0FSRSBPUiBU\nSEUgVVNFIE9SIE9USEVSIERFQUxJTkdTIElOIFRIRSBTT0ZUV0FSRS4K\n", "encoding": "base64", "_links": { "self": "https://api.github.com/repos/benbalter/gman/contents/LICENSE?ref=master", "git": "https://api.github.com/repos/benbalter/gman/git/blobs/401c59dcc4570b954dd6d345e76199e1f4e76266", "html": "https://github.com/benbalter/gman/blob/master/LICENSE" }, "license": { "key": "mit", "name": "MIT License", "spdx_id": "MIT", "url": "https://api.github.com/licenses/mit", "node_id": "MDc6TGljZW5zZW1pdA==" } }