Diese Version von GitHub Enterprise Server wurde eingestellt am 2024-03-26. Es wird keine Patch-Freigabe vorgenommen, auch nicht für kritische Sicherheitsprobleme. Für bessere Leistung, verbesserte Sicherheit und neue Features aktualisiere auf die neueste Version von GitHub Enterprise Server. Wende dich an den GitHub Enterprise-Support, um Hilfe zum Upgrade zu erhalten.
REST-API-Endpunkte für Gists
Verwende die REST-API, um die öffentlichen Gists auf GitHub aufzulisten, zu erstellen, zu aktualisieren und zu löschen.
Informationen zu Gists
Du kannst die REST-API verwenden, um Gists anzuzeigen und zu ändern. Weitere Informationen zu Gists findest du unter Inhalte mit Gists bearbeiten und freigeben.
Authentifizierung
Du kannst öffentliche Gists lesen und sie für anonyme Benutzer ohne ein Token Um Gists im Auftrag eines Benutzers zu lesen oder zu schreiben, benötigst du den OAuth-Bereich für Gist und ein Token. Weitere Informationen findest du unter Bereiche für OAuth-Apps.
Abschneiden
Die API bietet bis zu 1 Megabyte an Inhalten für jede Datei im Gist. Jede Datei, die für ein Gist über die API zurückgegeben wird, hat einen Schlüssel namens truncated
. Wenn truncated
gleich true
ist, ist die Datei zu groß, sodass nur ein Teil des Inhalts in content
zurückgegeben wurde.
Wenn du den gesamten Inhalt der Datei benötigst, kannst du die Anforderung GET
an die durch raw_url
angegebene URL stellen. Beachte, dass du bei Dateien mit einer Größe von mehr als 10 Megabyte das Gist über die von git_pull_url
angegebene URL klonen musst.
Außerdem wird nicht nur der Inhalt einer bestimmten Datei abgeschnitten, sondern die gesamte Dateiliste, wenn die Gesamtanzahl 300 Dateien überschreitet. Wenn der Schlüssel auf oberster Ebene truncated
gleich true
ist, werden nur die ersten 300 Dateien in der Dateiliste angezeigt. Wenn du alle Dateien des Gists abrufen möchtest, musst du das Gist über die von git_pull_url
angegebene URL klonen.
List gists for the authenticated user
Lists the authenticated user's gists or if called anonymously, this endpoint returns all public gists:
Parameter für „List gists for the authenticated user“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
since string Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List gists for the authenticated user“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden |
Codebeispiele für „List gists for the authenticated user“
Beispiel für eine Anfrage
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists
Response
Status: 200
[
{
"url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d",
"forks_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/forks",
"commits_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/commits",
"id": "aa5a315d61ae9438b18d",
"node_id": "MDQ6R2lzdGFhNWEzMTVkNjFhZTk0MzhiMThk",
"git_pull_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"git_push_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"html_url": "https://gist.github.com/aa5a315d61ae9438b18d",
"files": {
"hello_world.rb": {
"filename": "hello_world.rb",
"type": "application/x-ruby",
"language": "Ruby",
"raw_url": "https://gist.githubusercontent.com/octocat/6cad326836d38bd3a7ae/raw/db9c55113504e46fa076e7df3a04ce592e2e86d8/hello_world.rb",
"size": 167
}
},
"public": true,
"created_at": "2010-04-14T02:15:15Z",
"updated_at": "2011-06-20T11:34:15Z",
"description": "Hello World Examples",
"comments": 0,
"user": null,
"comments_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/comments/",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"truncated": false
}
]
Create a gist
Allows you to add a new gist with one or more files.
Note: Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally.
Parameter für „Create a gist“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG | |||||
---|---|---|---|---|---|
description string Description of the gist | |||||
files object ErforderlichNames and content for the files that make up the gist | |||||
Properties of |
Name, type, BESCHREIBUNG | ||
---|---|---|
key object A user-defined key to represent an item in | ||
Properties of |
Name, type, BESCHREIBUNG |
---|
content string ErforderlichContent of the file |
public
boolean or string Flag indicating whether the gist is public
HTTP-Antwortstatuscodes für „Create a gist“
Statuscode | BESCHREIBUNG |
---|---|
201 | Created |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Codebeispiele für „Create a gist“
Beispiel für eine Anfrage
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists \
-d '{"description":"Example of a gist","public":false,"files":{"README.md":{"content":"Hello World"}}}'
Response
Status: 201
{
"url": "https://HOSTNAME/gists/2decf6c462d9b4418f2",
"forks_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/forks",
"commits_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/commits",
"id": "2decf6c462d9b4418f2",
"node_id": "G_kwDOBhHyLdZDliNDQxOGYy",
"git_pull_url": "https://gist.github.com/2decf6c462d9b4418f2.git",
"git_push_url": "https://gist.github.com/2decf6c462d9b4418f2.git",
"html_url": "https://gist.github.com/2decf6c462d9b4418f2",
"files": {
"README.md": {
"filename": "README.md",
"type": "text/markdown",
"language": "Markdown",
"raw_url": "https://gist.githubusercontent.com/monalisa/2decf6c462d9b4418f2/raw/ac3e6daf176fafe73609fd000cd188e4472010fb/README.md",
"size": 23,
"truncated": false,
"content": "Hello world from GitHub"
}
},
"public": true,
"created_at": "2022-09-20T12:11:58Z",
"updated_at": "2022-09-21T10:28:06Z",
"description": "An updated gist description.",
"comments": 0,
"user": null,
"comments_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/comments",
"owner": {
"login": "monalisa",
"id": 104456405,
"node_id": "U_kgDOBhHyLQ",
"avatar_url": "https://avatars.githubusercontent.com/u/104456405?v=4",
"gravatar_id": "",
"url": "https://HOSTNAME/users/monalisa",
"html_url": "https://github.com/monalisa",
"followers_url": "https://HOSTNAME/users/monalisa/followers",
"following_url": "https://HOSTNAME/users/monalisa/following{/other_user}",
"gists_url": "https://HOSTNAME/users/monalisa/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/monalisa/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/monalisa/subscriptions",
"organizations_url": "https://HOSTNAME/users/monalisa/orgs",
"repos_url": "https://HOSTNAME/users/monalisa/repos",
"events_url": "https://HOSTNAME/users/monalisa/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/monalisa/received_events",
"type": "User",
"site_admin": true
},
"forks": [],
"history": [
{
"user": {
"login": "monalisa",
"id": 104456405,
"node_id": "U_kgyLQ",
"avatar_url": "https://avatars.githubusercontent.com/u/104456405?v=4",
"gravatar_id": "",
"url": "https://HOSTNAME/users/monalisa",
"html_url": "https://github.com/monalisa",
"followers_url": "https://HOSTNAME/users/monalisa/followers",
"following_url": "https://HOSTNAME/users/monalisa/following{/other_user}",
"gists_url": "https://HOSTNAME/users/monalisa/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/monalisa/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/monalisa/subscriptions",
"organizations_url": "https://HOSTNAME/users/monalisa/orgs",
"repos_url": "https://HOSTNAME/users/monalisa/repos",
"events_url": "https://HOSTNAME/users/monalisa/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/monalisa/received_events",
"type": "User",
"site_admin": true
},
"version": "468aac8caed5f0c3b859b8286968",
"committed_at": "2022-09-21T10:28:06Z",
"change_status": {
"total": 2,
"additions": 1,
"deletions": 1
},
"url": "https://HOSTNAME/gists/8481a81af6b7a2d418f2/468aac8caed5f0c3b859b8286968"
}
],
"truncated": false
}
List public gists
List public gists sorted by most recently updated to least recently updated.
Note: With pagination, you can fetch up to 3000 gists. For example, you can fetch 100 pages with 30 gists per page or 30 pages with 100 gists per page.
Parameter für „List public gists“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
since string Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List public gists“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden |
422 | Validation failed, or the endpoint has been spammed. |
Codebeispiele für „List public gists“
Beispiel für eine Anfrage
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/public
Response
Status: 200
[
{
"url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d",
"forks_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/forks",
"commits_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/commits",
"id": "aa5a315d61ae9438b18d",
"node_id": "MDQ6R2lzdGFhNWEzMTVkNjFhZTk0MzhiMThk",
"git_pull_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"git_push_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"html_url": "https://gist.github.com/aa5a315d61ae9438b18d",
"files": {
"hello_world.rb": {
"filename": "hello_world.rb",
"type": "application/x-ruby",
"language": "Ruby",
"raw_url": "https://gist.githubusercontent.com/octocat/6cad326836d38bd3a7ae/raw/db9c55113504e46fa076e7df3a04ce592e2e86d8/hello_world.rb",
"size": 167
}
},
"public": true,
"created_at": "2010-04-14T02:15:15Z",
"updated_at": "2011-06-20T11:34:15Z",
"description": "Hello World Examples",
"comments": 0,
"user": null,
"comments_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/comments/",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"truncated": false
}
]
List starred gists
List the authenticated user's starred gists:
Parameter für „List starred gists“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
since string Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List starred gists“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
Codebeispiele für „List starred gists“
Beispiel für eine Anfrage
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/starred
Response
Status: 200
[
{
"url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d",
"forks_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/forks",
"commits_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/commits",
"id": "aa5a315d61ae9438b18d",
"node_id": "MDQ6R2lzdGFhNWEzMTVkNjFhZTk0MzhiMThk",
"git_pull_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"git_push_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"html_url": "https://gist.github.com/aa5a315d61ae9438b18d",
"files": {
"hello_world.rb": {
"filename": "hello_world.rb",
"type": "application/x-ruby",
"language": "Ruby",
"raw_url": "https://gist.githubusercontent.com/octocat/6cad326836d38bd3a7ae/raw/db9c55113504e46fa076e7df3a04ce592e2e86d8/hello_world.rb",
"size": 167
}
},
"public": true,
"created_at": "2010-04-14T02:15:15Z",
"updated_at": "2011-06-20T11:34:15Z",
"description": "Hello World Examples",
"comments": 0,
"user": null,
"comments_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/comments/",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"truncated": false
}
]
Get a gist
Gets a specified gist.
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd.github.raw+json
: Returns the raw markdown. This is the default if you do not pass any specific media type.application/vnd.github.base64+json
: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.
Parameter für „Get a gist“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
gist_id string ErforderlichThe unique identifier of the gist. |
HTTP-Antwortstatuscodes für „Get a gist“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden Gist |
404 | Resource not found |
Codebeispiele für „Get a gist“
Beispiel für eine Anfrage
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/GIST_ID
Response
Status: 200
{
"url": "https://HOSTNAME/gists/2decf6c462d9b4418f2",
"forks_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/forks",
"commits_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/commits",
"id": "2decf6c462d9b4418f2",
"node_id": "G_kwDOBhHyLdZDliNDQxOGYy",
"git_pull_url": "https://gist.github.com/2decf6c462d9b4418f2.git",
"git_push_url": "https://gist.github.com/2decf6c462d9b4418f2.git",
"html_url": "https://gist.github.com/2decf6c462d9b4418f2",
"files": {
"README.md": {
"filename": "README.md",
"type": "text/markdown",
"language": "Markdown",
"raw_url": "https://gist.githubusercontent.com/monalisa/2decf6c462d9b4418f2/raw/ac3e6daf176fafe73609fd000cd188e4472010fb/README.md",
"size": 23,
"truncated": false,
"content": "Hello world from GitHub"
}
},
"public": true,
"created_at": "2022-09-20T12:11:58Z",
"updated_at": "2022-09-21T10:28:06Z",
"description": "An updated gist description.",
"comments": 0,
"user": null,
"comments_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/comments",
"owner": {
"login": "monalisa",
"id": 104456405,
"node_id": "U_kgDOBhHyLQ",
"avatar_url": "https://avatars.githubusercontent.com/u/104456405?v=4",
"gravatar_id": "",
"url": "https://HOSTNAME/users/monalisa",
"html_url": "https://github.com/monalisa",
"followers_url": "https://HOSTNAME/users/monalisa/followers",
"following_url": "https://HOSTNAME/users/monalisa/following{/other_user}",
"gists_url": "https://HOSTNAME/users/monalisa/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/monalisa/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/monalisa/subscriptions",
"organizations_url": "https://HOSTNAME/users/monalisa/orgs",
"repos_url": "https://HOSTNAME/users/monalisa/repos",
"events_url": "https://HOSTNAME/users/monalisa/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/monalisa/received_events",
"type": "User",
"site_admin": true
},
"forks": [],
"history": [
{
"user": {
"login": "monalisa",
"id": 104456405,
"node_id": "U_kgyLQ",
"avatar_url": "https://avatars.githubusercontent.com/u/104456405?v=4",
"gravatar_id": "",
"url": "https://HOSTNAME/users/monalisa",
"html_url": "https://github.com/monalisa",
"followers_url": "https://HOSTNAME/users/monalisa/followers",
"following_url": "https://HOSTNAME/users/monalisa/following{/other_user}",
"gists_url": "https://HOSTNAME/users/monalisa/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/monalisa/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/monalisa/subscriptions",
"organizations_url": "https://HOSTNAME/users/monalisa/orgs",
"repos_url": "https://HOSTNAME/users/monalisa/repos",
"events_url": "https://HOSTNAME/users/monalisa/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/monalisa/received_events",
"type": "User",
"site_admin": true
},
"version": "468aac8caed5f0c3b859b8286968",
"committed_at": "2022-09-21T10:28:06Z",
"change_status": {
"total": 2,
"additions": 1,
"deletions": 1
},
"url": "https://HOSTNAME/gists/8481a81af6b7a2d418f2/468aac8caed5f0c3b859b8286968"
}
],
"truncated": false
}
Update a gist
Allows you to update a gist's description and to update, delete, or rename gist files. Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged.
At least one of description
or files
is required.
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd.github.raw+json
: Returns the raw markdown. This is the default if you do not pass any specific media type.application/vnd.github.base64+json
: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.
Parameter für „Update a gist“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
gist_id string ErforderlichThe unique identifier of the gist. |
Name, type, BESCHREIBUNG | ||||||
---|---|---|---|---|---|---|
description string The description of the gist. | ||||||
files object The gist files to be updated, renamed, or deleted. Each To delete a file, set the whole file to null. For example: | ||||||
Properties of |
Name, type, BESCHREIBUNG | |||
---|---|---|---|
key object A user-defined key to represent an item in | |||
Properties of |
Name, type, BESCHREIBUNG |
---|
content string The new content of the file. |
filename string or null The new filename for the file. |
HTTP-Antwortstatuscodes für „Update a gist“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Codebeispiele für „Update a gist“
Beispiele für Anforderungen
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/GIST_ID \
-d '{"description":"An updated gist description","files":{"README.md":{"content":"Hello World from GitHub"}}}'
Response
Status: 200
{
"url": "https://HOSTNAME/gists/2decf6c462d9b4418f2",
"forks_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/forks",
"commits_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/commits",
"id": "2decf6c462d9b4418f2",
"node_id": "G_kwDOBhHyLdZDliNDQxOGYy",
"git_pull_url": "https://gist.github.com/2decf6c462d9b4418f2.git",
"git_push_url": "https://gist.github.com/2decf6c462d9b4418f2.git",
"html_url": "https://gist.github.com/2decf6c462d9b4418f2",
"files": {
"README.md": {
"filename": "README.md",
"type": "text/markdown",
"language": "Markdown",
"raw_url": "https://gist.githubusercontent.com/monalisa/2decf6c462d9b4418f2/raw/ac3e6daf176fafe73609fd000cd188e4472010fb/README.md",
"size": 23,
"truncated": false,
"content": "Hello world from GitHub"
}
},
"public": true,
"created_at": "2022-09-20T12:11:58Z",
"updated_at": "2022-09-21T10:28:06Z",
"description": "An updated gist description.",
"comments": 0,
"user": null,
"comments_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/comments",
"owner": {
"login": "monalisa",
"id": 104456405,
"node_id": "U_kgDOBhHyLQ",
"avatar_url": "https://avatars.githubusercontent.com/u/104456405?v=4",
"gravatar_id": "",
"url": "https://HOSTNAME/users/monalisa",
"html_url": "https://github.com/monalisa",
"followers_url": "https://HOSTNAME/users/monalisa/followers",
"following_url": "https://HOSTNAME/users/monalisa/following{/other_user}",
"gists_url": "https://HOSTNAME/users/monalisa/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/monalisa/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/monalisa/subscriptions",
"organizations_url": "https://HOSTNAME/users/monalisa/orgs",
"repos_url": "https://HOSTNAME/users/monalisa/repos",
"events_url": "https://HOSTNAME/users/monalisa/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/monalisa/received_events",
"type": "User",
"site_admin": true
},
"forks": [],
"history": [
{
"user": {
"login": "monalisa",
"id": 104456405,
"node_id": "U_kgyLQ",
"avatar_url": "https://avatars.githubusercontent.com/u/104456405?v=4",
"gravatar_id": "",
"url": "https://HOSTNAME/users/monalisa",
"html_url": "https://github.com/monalisa",
"followers_url": "https://HOSTNAME/users/monalisa/followers",
"following_url": "https://HOSTNAME/users/monalisa/following{/other_user}",
"gists_url": "https://HOSTNAME/users/monalisa/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/monalisa/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/monalisa/subscriptions",
"organizations_url": "https://HOSTNAME/users/monalisa/orgs",
"repos_url": "https://HOSTNAME/users/monalisa/repos",
"events_url": "https://HOSTNAME/users/monalisa/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/monalisa/received_events",
"type": "User",
"site_admin": true
},
"version": "468aac8caed5f0c3b859b8286968",
"committed_at": "2022-09-21T10:28:06Z",
"change_status": {
"total": 2,
"additions": 1,
"deletions": 1
},
"url": "https://HOSTNAME/gists/8481a81af6b7a2d418f2/468aac8caed5f0c3b859b8286968"
}
],
"truncated": false
}
Delete a gist
Parameter für „Delete a gist“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
gist_id string ErforderlichThe unique identifier of the gist. |
HTTP-Antwortstatuscodes für „Delete a gist“
Statuscode | BESCHREIBUNG |
---|---|
204 | No Content |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Codebeispiele für „Delete a gist“
Beispiel für eine Anfrage
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/GIST_ID
Response
Status: 204
List gist commits
Parameter für „List gist commits“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
gist_id string ErforderlichThe unique identifier of the gist. |
Name, type, BESCHREIBUNG |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List gist commits“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Codebeispiele für „List gist commits“
Beispiel für eine Anfrage
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/GIST_ID/commits
Response
Status: 200
[
{
"url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/57a7f021a713b1c5a6a199b54cc514735d2d462f",
"version": "57a7f021a713b1c5a6a199b54cc514735d2d462f",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"change_status": {
"deletions": 0,
"additions": 180,
"total": 180
},
"committed_at": "2010-04-14T02:15:15Z"
}
]
List gist forks
Parameter für „List gist forks“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
gist_id string ErforderlichThe unique identifier of the gist. |
Name, type, BESCHREIBUNG |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List gist forks“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Codebeispiele für „List gist forks“
Beispiel für eine Anfrage
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/GIST_ID/forks
Response
Status: 200
[
{
"url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d",
"forks_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/forks",
"commits_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/commits",
"id": "aa5a315d61ae9438b18d",
"node_id": "MDQ6R2lzdGFhNWEzMTVkNjFhZTk0MzhiMThk",
"git_pull_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"git_push_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"html_url": "https://gist.github.com/aa5a315d61ae9438b18d",
"files": {
"hello_world.rb": {
"filename": "hello_world.rb",
"type": "application/x-ruby",
"language": "Ruby",
"raw_url": "https://gist.githubusercontent.com/octocat/6cad326836d38bd3a7ae/raw/db9c55113504e46fa076e7df3a04ce592e2e86d8/hello_world.rb",
"size": 167
}
},
"public": true,
"created_at": "2010-04-14T02:15:15Z",
"updated_at": "2011-06-20T11:34:15Z",
"description": "Hello World Examples",
"comments": 1,
"user": null,
"comments_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/comments/",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
}
}
]
Fork a gist
Parameter für „Fork a gist“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
gist_id string ErforderlichThe unique identifier of the gist. |
HTTP-Antwortstatuscodes für „Fork a gist“
Statuscode | BESCHREIBUNG |
---|---|
201 | Created |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Codebeispiele für „Fork a gist“
Beispiel für eine Anfrage
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/GIST_ID/forks
Response
Status: 201
{
"url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d",
"forks_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/forks",
"commits_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/commits",
"id": "aa5a315d61ae9438b18d",
"node_id": "MDQ6R2lzdGFhNWEzMTVkNjFhZTk0MzhiMThk",
"git_pull_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"git_push_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"html_url": "https://gist.github.com/aa5a315d61ae9438b18d",
"files": {
"hello_world.rb": {
"filename": "hello_world.rb",
"type": "application/x-ruby",
"language": "Ruby",
"raw_url": "https://gist.githubusercontent.com/octocat/6cad326836d38bd3a7ae/raw/db9c55113504e46fa076e7df3a04ce592e2e86d8/hello_world.rb",
"size": 167
}
},
"public": true,
"created_at": "2010-04-14T02:15:15Z",
"updated_at": "2011-06-20T11:34:15Z",
"description": "Hello World Examples",
"comments": 0,
"user": null,
"comments_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/comments/",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"truncated": false
}
Check if a gist is starred
Parameter für „Check if a gist is starred“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
gist_id string ErforderlichThe unique identifier of the gist. |
HTTP-Antwortstatuscodes für „Check if a gist is starred“
Statuscode | BESCHREIBUNG |
---|---|
204 | Response if gist is starred |
304 | Not modified |
403 | Forbidden |
404 | Not Found if gist is not starred |
Codebeispiele für „Check if a gist is starred“
Beispiel für eine Anfrage
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/GIST_ID/star
Response if gist is starred
Status: 204
Star a gist
Note that you'll need to set Content-Length
to zero when calling out to this endpoint. For more information, see "HTTP method."
Parameter für „Star a gist“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
gist_id string ErforderlichThe unique identifier of the gist. |
HTTP-Antwortstatuscodes für „Star a gist“
Statuscode | BESCHREIBUNG |
---|---|
204 | No Content |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Codebeispiele für „Star a gist“
Beispiel für eine Anfrage
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/GIST_ID/star
Response
Status: 204
Unstar a gist
Parameter für „Unstar a gist“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
gist_id string ErforderlichThe unique identifier of the gist. |
HTTP-Antwortstatuscodes für „Unstar a gist“
Statuscode | BESCHREIBUNG |
---|---|
204 | No Content |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Codebeispiele für „Unstar a gist“
Beispiel für eine Anfrage
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/GIST_ID/star
Response
Status: 204
Get a gist revision
Gets a specified gist revision.
This endpoint supports the following custom media types. For more information, see "Media types."
application/vnd.github.raw+json
: Returns the raw markdown. This is the default if you do not pass any specific media type.application/vnd.github.base64+json
: Returns the base64-encoded contents. This can be useful if your gist contains any invalid UTF-8 sequences.
Parameter für „Get a gist revision“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
gist_id string ErforderlichThe unique identifier of the gist. |
sha string Erforderlich |
HTTP-Antwortstatuscodes für „Get a gist revision“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Codebeispiele für „Get a gist revision“
Beispiel für eine Anfrage
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/gists/GIST_ID/SHA
Response
Status: 200
{
"url": "https://HOSTNAME/gists/2decf6c462d9b4418f2",
"forks_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/forks",
"commits_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/commits",
"id": "2decf6c462d9b4418f2",
"node_id": "G_kwDOBhHyLdZDliNDQxOGYy",
"git_pull_url": "https://gist.github.com/2decf6c462d9b4418f2.git",
"git_push_url": "https://gist.github.com/2decf6c462d9b4418f2.git",
"html_url": "https://gist.github.com/2decf6c462d9b4418f2",
"files": {
"README.md": {
"filename": "README.md",
"type": "text/markdown",
"language": "Markdown",
"raw_url": "https://gist.githubusercontent.com/monalisa/2decf6c462d9b4418f2/raw/ac3e6daf176fafe73609fd000cd188e4472010fb/README.md",
"size": 23,
"truncated": false,
"content": "Hello world from GitHub"
}
},
"public": true,
"created_at": "2022-09-20T12:11:58Z",
"updated_at": "2022-09-21T10:28:06Z",
"description": "An updated gist description.",
"comments": 0,
"user": null,
"comments_url": "https://HOSTNAME/gists/2decf6c462d9b4418f2/comments",
"owner": {
"login": "monalisa",
"id": 104456405,
"node_id": "U_kgDOBhHyLQ",
"avatar_url": "https://avatars.githubusercontent.com/u/104456405?v=4",
"gravatar_id": "",
"url": "https://HOSTNAME/users/monalisa",
"html_url": "https://github.com/monalisa",
"followers_url": "https://HOSTNAME/users/monalisa/followers",
"following_url": "https://HOSTNAME/users/monalisa/following{/other_user}",
"gists_url": "https://HOSTNAME/users/monalisa/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/monalisa/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/monalisa/subscriptions",
"organizations_url": "https://HOSTNAME/users/monalisa/orgs",
"repos_url": "https://HOSTNAME/users/monalisa/repos",
"events_url": "https://HOSTNAME/users/monalisa/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/monalisa/received_events",
"type": "User",
"site_admin": true
},
"forks": [],
"history": [
{
"user": {
"login": "monalisa",
"id": 104456405,
"node_id": "U_kgyLQ",
"avatar_url": "https://avatars.githubusercontent.com/u/104456405?v=4",
"gravatar_id": "",
"url": "https://HOSTNAME/users/monalisa",
"html_url": "https://github.com/monalisa",
"followers_url": "https://HOSTNAME/users/monalisa/followers",
"following_url": "https://HOSTNAME/users/monalisa/following{/other_user}",
"gists_url": "https://HOSTNAME/users/monalisa/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/monalisa/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/monalisa/subscriptions",
"organizations_url": "https://HOSTNAME/users/monalisa/orgs",
"repos_url": "https://HOSTNAME/users/monalisa/repos",
"events_url": "https://HOSTNAME/users/monalisa/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/monalisa/received_events",
"type": "User",
"site_admin": true
},
"version": "468aac8caed5f0c3b859b8286968",
"committed_at": "2022-09-21T10:28:06Z",
"change_status": {
"total": 2,
"additions": 1,
"deletions": 1
},
"url": "https://HOSTNAME/gists/8481a81af6b7a2d418f2/468aac8caed5f0c3b859b8286968"
}
],
"truncated": false
}
List gists for a user
Lists public gists for the specified user:
Parameter für „List gists for a user“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
username string ErforderlichThe handle for the GitHub user account. |
Name, type, BESCHREIBUNG |
---|
since string Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List gists for a user“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
422 | Validation failed, or the endpoint has been spammed. |
Codebeispiele für „List gists for a user“
Beispiel für eine Anfrage
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/users/USERNAME/gists
Response
Status: 200
[
{
"url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d",
"forks_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/forks",
"commits_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/commits",
"id": "aa5a315d61ae9438b18d",
"node_id": "MDQ6R2lzdGFhNWEzMTVkNjFhZTk0MzhiMThk",
"git_pull_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"git_push_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
"html_url": "https://gist.github.com/aa5a315d61ae9438b18d",
"files": {
"hello_world.rb": {
"filename": "hello_world.rb",
"type": "application/x-ruby",
"language": "Ruby",
"raw_url": "https://gist.githubusercontent.com/octocat/6cad326836d38bd3a7ae/raw/db9c55113504e46fa076e7df3a04ce592e2e86d8/hello_world.rb",
"size": 167
}
},
"public": true,
"created_at": "2010-04-14T02:15:15Z",
"updated_at": "2011-06-20T11:34:15Z",
"description": "Hello World Examples",
"comments": 0,
"user": null,
"comments_url": "https://HOSTNAME/gists/aa5a315d61ae9438b18d/comments/",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"truncated": false
}
]