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.

Commitc339901

Browse files
author
Chad Humphries
committed
Merge pull request#153 from github/jasonrudolph☃gist-api-truncating-large-files-blog-post
Suggested edits to Gist file truncation post
2 parents07d3bbf +268e1bc commitc339901

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
---
22
kind:change
3-
title:"Gist APInow truncates large files"
3+
title:"Changes toGist APIresponse for large files"
44
created_at:2014-04-22
55
author_name:leongersing
66
---
77

8-
In order to provide the most robust, fast and accurate API for Gist werecently decided to make a few small changes to the*files* attribute.
8+
In order to provide the most robust, fast and accurate API for Gist, weare making two changes to better handle large files in[Gist API responses][gist-json-representation].
99

10-
###Truncating file contents larger than 1MB
11-
This change imposes a sensible (according to our data) limit on the amount of raw file data that is returned in gist fetches via the API. This means faster response times while eliminating browser timeouts when fetching gists that contains large files. When you need the full contents of your gist's file, simply make a request to the url specified in the raw_url attribute.
10+
###Truncating file contents larger than one megabyte
1211

13-
###"truncated" attribute
12+
The[Gist API response][gist-json-representation] includes data for every file in the Gist. That works well for Gists with reasonably-sized files. When a Gist contains large files, however, it can lead to timeouts when preparing or sending the API response.
13+
14+
To eliminate those timeouts, the API now limits the amount of content returned for each file. If a file is larger than one megabyte in size, the API response will include the first megabyte of content for that file. (Few Gists have files this large. As a result, most API clients won't notice any impact from this change.)
15+
16+
###New "truncated" attribute
17+
18+
The JSON snippet below illustrates the attributes provided for each file in the Gist API response. In it, you'll notice a new**truncated** attribute included as part of the file metadata. This Boolean attribute indicates whether the`content` value is truncated for this request.
1419

1520
{
1621
files: {
1722
"my_large_file.md": {
1823
"size": 2097152,
24+
"content": "Large content. Truncated at end of first megabyte. [...]",
25+
"truncated": true,
1926
"raw_url": "https://raw.githubusercontent.com/[...]/my_large_file.md",
2027
"type": "text/plain",
21-
"language": "Markdown",
22-
"content": "",
23-
"truncated": true
28+
"language": "Markdown"
2429
}
2530
}
2631
}
2732

28-
In this small example payload, you'll notice the new**truncated** attribute has been added to each file's payload. It is a boolean attribute indicating if the content attribute's value has been truncated for this request.
33+
###Getting the full content for truncated files
34+
35+
We recognize that sometimes you'll still want the full content for a file, even if it's too large to get returned in the standard Gist API response. In those cases, simply make a request to the URL specified in the`raw_url` attribute, and you'll receive the complete content for that file.
2936

30-
If you have any questions,please[get in touch][contact].
37+
If you have any questions,don’t hesitate to[get in touch][contact].
3138

3239
[contact]:https://github.com/contact?form[subject]=Gist+API+now+tuncates+large+files
40+
[gist-json-representation]:/v3/gists/#detailed-gist-representation

‎content/v3/gists.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Name | Type | Description
4949

5050
GET /gists/:id
5151

52-
###Response
52+
###Response {#detailed-gist-representation}
5353

5454
<%= headers 200 %>
5555
<%= json:full_gist %>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp