Sample - GitHub REST API
GET/repos/{owner}/{repo}/license

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.
  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

3 parameters
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
refstringoptional
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`.

2 status codes
200Response
namestringrequired
pathstringrequired
shastringrequired
sizeintegerrequired
urlstringrequired
html_urlstringrequired
git_urlstringrequired
download_urlstringrequired
typestringrequired
contentstringrequired
encodingstringrequired
_linksobjectrequired
licenseobjectrequired
License Simple
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 404 is returned: Resource not found.