Skip to content

Commit 0d1da0c

Browse files
committed
Merge pull request github#310 from github/clarify-release-upload-responses
Clarify release upload responses
2 parents 52eee61 + 3bfccae commit 0d1da0c

File tree

2 files changed

+14
-91
lines changed

2 files changed

+14
-91
lines changed

content/v3/repos/downloads.md

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -29,96 +29,6 @@ instead.
2929
<%= headers 200 %>
3030
<%= json :download %>
3131

32-
## Create a new download (Part 1: Create the resource)
33-
34-
Creating a new download is a two step process. You must first create a
35-
new download resource.
36-
37-
POST /repos/:owner/:repo/downloads
38-
39-
### Input
40-
41-
name
42-
: _Required_ **string**
43-
44-
size
45-
: _Required_ **number** - Size of file in bytes.
46-
47-
description
48-
: _Optional_ **string**
49-
50-
content\_type
51-
: _Optional_ **string**
52-
53-
<%= json \
54-
:name => "new_file.jpg",
55-
:size => 114034,
56-
:description => "Latest release",
57-
:content_type => "text/plain"
58-
%>
59-
60-
### Response
61-
62-
<%= headers 201, :Location => "https://api.github.com/user/repo/downloads/1" %>
63-
<%= json :create_download %>
64-
65-
## Create a new download (Part 2: Upload file to s3)
66-
67-
Now that you have created the download resource, you can use the
68-
information in the response to upload your file to s3. This can be done
69-
with a `POST` to the `s3_url` you got in the create response. Here is a
70-
brief example using curl:
71-
72-
curl \
73-
-F "key=downloads/octocat/Hello-World/new_file.jpg" \
74-
-F "acl=public-read" \
75-
-F "success_action_status=201" \
76-
-F "Filename=new_file.jpg" \
77-
-F "AWSAccessKeyId=1ABCDEF..." \
78-
-F "Policy=ewogIC..." \
79-
-F "Signature=mwnF..." \
80-
-F "Content-Type=image/jpeg" \
81-
-F "file=@new_file.jpg" \
82-
https://github.s3.amazonaws.com/
83-
84-
NOTES
85-
86-
The order in which you pass these fields matters! Follow the order shown
87-
above exactly. All parameters shown are required and if you excluded or
88-
modify them your upload will fail because the values are hashed and signed
89-
by the policy.
90-
91-
key
92-
: Value of `path` field in the response.
93-
94-
acl
95-
: Value of `acl` field in the response.
96-
97-
success_action_status
98-
: 201, or whatever you want to get back.
99-
100-
Filename
101-
: Value of `name` field in the response.
102-
103-
AWSAccessKeyId
104-
: Value of `accesskeyid` field in the response.
105-
106-
Policy
107-
: Value of `policy` field in the response.
108-
109-
Signature
110-
: Value of `signature` field in the response.
111-
112-
Content-Type
113-
: Value of `mime_type` field in the response.
114-
115-
file
116-
: Local file. Example assumes the file existing in the directory where
117-
you are running the curl command. Yes, the `@` matters.
118-
119-
More information about using the REST API to interact with s3 can
120-
be found [here](http://docs.amazonwebservices.com/AmazonS3/latest/API/).
121-
12232
## Delete a download
12333

12434
DELETE /repos/:owner/:repo/downloads/:id

content/v3/repos/releases.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,24 @@ name (URI query parameter)
185185

186186
Send the raw binary content of the asset as the request body.
187187

188-
### Response
188+
### Response for successful upload
189189

190190
<%= headers 201 %>
191191
<%= json :release_asset %>
192192

193+
### Response for accepted upload
194+
195+
The upload did not complete, but we will keep trying.
196+
197+
<%= headers 202 %>
198+
<%= json :release_asset %>
199+
200+
### Response for upstream failure
201+
202+
This may leave an empty asset with a state of "new". It can be safely deleted.
203+
204+
<%= headers 502 %>
205+
193206
## Get a single release asset
194207

195208
GET /repos/:owner/:repo/releases/assets/:id

0 commit comments

Comments
 (0)