|
1 | 1 | # Atom.io package and update API
|
2 | 2 |
|
3 |
| -This guide describes the web API used by [apm](https://github.com/atom/apm) and |
4 |
| -Atom. The vast majority of use cases are met by the `apm` command-line tool, |
5 |
| -which does other useful things like incrementing your version in `package.json` |
6 |
| -and making sure you have pushed your git tag. In fact, Atom itself shells out to |
7 |
| -`apm` rather than hitting the API directly. If you're curious about how Atom |
8 |
| -uses `apm`, see the [PackageManager class](https://github.com/atom/settings-view/blob/master/lib/package-manager.coffee) |
9 |
| -in the `settings-view` package. |
10 |
| - |
11 |
| -*This API should be considered pre-release and is subject to change (though significant breaking changes are unlikely).* |
12 |
| - |
13 |
| -### Authorization |
14 |
| - |
15 |
| -For calls to the API that require authentication, provide a valid token from your |
16 |
| -[Atom.io account page](https://atom.io/account) in the `Authorization` header. |
17 |
| - |
18 |
| -### Media type |
19 |
| - |
20 |
| -All requests that take parameters require `application/json`. |
21 |
| - |
22 |
| -# API Resources |
23 |
| - |
24 |
| -## Packages |
25 |
| - |
26 |
| -### Listing packages |
27 |
| - |
28 |
| -#### GET /api/packages |
29 |
| - |
30 |
| -Parameters: |
31 |
| - |
32 |
| -- **page** (optional) |
33 |
| -- **sort** (optional) - One of `downloads`, `created_at`, `updated_at`, `stars`. Defaults to `downloads` |
34 |
| -- **direction** (optional) - `asc` or `desc`. Defaults to `desc`. `stars` can only be ordered `desc` |
35 |
| - |
36 |
| -Returns a list of all packages in the following format: |
37 |
| -```json |
38 |
| - [ |
39 |
| - { |
40 |
| - "releases": { |
41 |
| - "latest": "0.6.0" |
42 |
| - }, |
43 |
| - "name": "thedaniel-test-package", |
44 |
| - "repository": { |
45 |
| - "type": "git", |
46 |
| - "url": "https://github.com/thedaniel/test-package" |
47 |
| - } |
48 |
| - }, |
49 |
| - ... |
50 |
| - ] |
51 |
| -``` |
52 |
| - |
53 |
| -Results are paginated 30 at a time, and links to the next and last pages are |
54 |
| -provided in the `Link` header: |
55 |
| - |
56 |
| -``` |
57 |
| -Link: <https://www.atom.io/api/packages?page=1>; rel="self", |
58 |
| - <https://www.atom.io/api/packages?page=41>; rel="last", |
59 |
| - <https://www.atom.io/api/packages?page=2>; rel="next" |
60 |
| -``` |
61 |
| - |
62 |
| -By default, results are sorted by download count, descending. |
63 |
| - |
64 |
| -### Searching packages |
65 |
| - |
66 |
| -#### GET /api/packages/search |
67 |
| - |
68 |
| -Parameters: |
69 |
| - |
70 |
| -- **q** (required) - Search query |
71 |
| -- **page** (optional) |
72 |
| -- **sort** (optional) - One of `downloads`, `created_at`, `updated_at`, `stars`. Defaults to the relevance of the search query. |
73 |
| -- **direction** (optional) - `asc` or `desc`. Defaults to `desc`. |
74 |
| - |
75 |
| -Returns results in the same format as [listing packages](#listing-packages). |
76 |
| - |
77 |
| -### Showing package details |
78 |
| - |
79 |
| -#### GET /api/packages/:package_name |
80 |
| - |
81 |
| -Returns package details and versions for a single package |
82 |
| - |
83 |
| -Parameters: |
84 |
| - |
85 |
| -- **engine** (optional) - Only show packages with versions compatible with this |
86 |
| - Atom version. Must be valid [SemVer](http://semver.org). |
87 |
| - |
88 |
| -Returns: |
89 |
| - |
90 |
| -```json |
91 |
| - { |
92 |
| - "releases": { |
93 |
| - "latest": "0.6.0" |
94 |
| - }, |
95 |
| - "name": "thedaniel-test-package", |
96 |
| - "repository": { |
97 |
| - "type": "git", |
98 |
| - "url": "https://github.com/thedaniel/test-package" |
99 |
| - }, |
100 |
| - "versions": [ |
101 |
| - (see single version output below) |
102 |
| - ..., |
103 |
| - ] |
104 |
| - } |
105 |
| -``` |
106 |
| - |
107 |
| -### Creating a package |
108 |
| - |
109 |
| -#### POST /api/packages |
110 |
| - |
111 |
| -Create a new package; requires authentication. |
112 |
| - |
113 |
| -The name and version will be fetched from the `package.json` |
114 |
| -file in the specified repository. The authenticating user *must* have access |
115 |
| -to the indicated repository. |
116 |
| - |
117 |
| -Parameters: |
118 |
| - |
119 |
| -- **repository** - String. The repository containing the plugin, in the form "owner/repo" |
120 |
| - |
121 |
| -Returns: |
122 |
| - |
123 |
| -- **201** - Successfully created, returns created package. |
124 |
| -- **400** - Repository is inaccessible, nonexistent, not an atom package. Possible |
125 |
| - error messages include: |
126 |
| - - That repo does not exist, isn't an atom package, or atombot does not have access |
127 |
| - - The package.json at owner/repo isn't valid |
128 |
| -- **409** - A package by that name already exists |
129 |
| - |
130 |
| -### Deleting a package |
131 |
| - |
132 |
| -#### DELETE /api/packages/:package_name |
133 |
| - |
134 |
| -Delete a package; requires authentication. |
135 |
| - |
136 |
| -Returns: |
137 |
| - |
138 |
| -- **204** - Success |
139 |
| -- **400** - Repository is inaccessible |
140 |
| -- **401** - Unauthorized |
141 |
| - |
142 |
| -### Renaming a package |
143 |
| - |
144 |
| -Packages are renamed by publishing a new version with the name changed in `package.json` |
145 |
| -See [Creating a new package version](#creating-a-new-package-version) for details. |
146 |
| - |
147 |
| -Requests made to the previous name will forward to the new name. |
148 |
| - |
149 |
| -### Package Versions |
150 |
| - |
151 |
| -#### GET /api/packages/:package_name/versions/:version_name |
152 |
| - |
153 |
| -Returns `package.json` with `dist` key added for e.g. tarball download: |
154 |
| - |
155 |
| -```json |
156 |
| - { |
157 |
| - "bugs": { |
158 |
| - "url": "https://github.com/thedaniel/test-package/issues" |
159 |
| - }, |
160 |
| - "dependencies": { |
161 |
| - "async": "~0.2.6", |
162 |
| - "pegjs": "~0.7.0", |
163 |
| - "season": "~0.13.0" |
164 |
| - }, |
165 |
| - "description": "Expand snippets matching the current prefix with `tab`.", |
166 |
| - "dist": { |
167 |
| - "tarball": "https://codeload.github.com/..." |
168 |
| - }, |
169 |
| - "engines": { |
170 |
| - "atom": "*" |
171 |
| - }, |
172 |
| - "main": "./lib/snippets", |
173 |
| - "name": "thedaniel-test-package", |
174 |
| - "publishConfig": { |
175 |
| - "registry": "https://...", |
176 |
| - }, |
177 |
| - "repository": { |
178 |
| - "type": "git", |
179 |
| - "url": "https://github.com/thedaniel/test-package.git" |
180 |
| - }, |
181 |
| - "version": "0.6.0" |
182 |
| - } |
183 |
| -``` |
184 |
| - |
185 |
| - |
186 |
| -### Creating a new package version |
187 |
| - |
188 |
| -#### POST /api/packages/:package_name/versions |
189 |
| - |
190 |
| -Creates a new package version from a git tag; requires authentication. If `rename` |
191 |
| -is not `true`, the `name` field in `package.json` *must* match the current package |
192 |
| -name. |
193 |
| - |
194 |
| -#### Parameters |
195 |
| - |
196 |
| -- **tag** - A git tag for the version you'd like to create. It's important to note |
197 |
| - that the version name will not be taken from the tag, but from the `version` |
198 |
| - key in the `package.json` file at that ref. The authenticating user *must* have |
199 |
| - access to the package repository. |
200 |
| -- **rename** - Boolean indicating whether this version contains a new name for the package. |
201 |
| - |
202 |
| -#### Returns |
203 |
| - |
204 |
| -- **201** - Successfully created. Returns created version. |
205 |
| -- **400** - Git tag not found / Repository inaccessible / package.json invalid |
206 |
| -- **409** - Version exists |
207 |
| - |
208 |
| -### Deleting a version |
209 |
| - |
210 |
| -#### DELETE /api/packages/:package_name/versions/:version_name |
211 |
| - |
212 |
| -Deletes a package version; requires authentication. |
213 |
| - |
214 |
| -Note that a version cannot be republished with a different tag if it is deleted. |
215 |
| -If you need to delete the latest version of a package for e.g. security reasons, |
216 |
| -you'll need to increment the version when republishing. |
217 |
| - |
218 |
| -Returns 204 No Content |
219 |
| - |
220 |
| - |
221 |
| -## Stars |
222 |
| - |
223 |
| -### Listing user stars |
224 |
| - |
225 |
| -#### GET /api/users/:login/stars |
226 |
| - |
227 |
| -List a user's starred packages. |
228 |
| - |
229 |
| -Return value is similar to **GET /api/packages** |
230 |
| - |
231 |
| -#### GET /api/stars |
232 |
| - |
233 |
| -List the authenticated user's starred packages; requires authentication. |
234 |
| - |
235 |
| -Return value is similar to **GET /api/packages** |
236 |
| - |
237 |
| -### Starring a package |
238 |
| - |
239 |
| -#### POST /api/packages/:name/star |
240 |
| - |
241 |
| -Star a package; requires authentication. |
242 |
| - |
243 |
| -Returns a package. |
244 |
| - |
245 |
| -### Unstarring a package |
246 |
| - |
247 |
| -#### DELETE /api/packages/:name/star |
248 |
| - |
249 |
| -Unstar a package; requires authentication. |
250 |
| - |
251 |
| -Returns 204 No Content. |
252 |
| - |
253 |
| -### Listing a package's stargazers |
254 |
| - |
255 |
| -#### GET /api/packages/:name/stargazers |
256 |
| - |
257 |
| -List the users that have starred a package. |
258 |
| - |
259 |
| -Returns a list of user objects: |
260 |
| - |
261 |
| -```json |
262 |
| -[ |
263 |
| - {"login":"aperson"}, |
264 |
| - {"login":"anotherperson"}, |
265 |
| -] |
266 |
| -``` |
267 |
| - |
268 |
| -## Atom updates |
269 |
| - |
270 |
| -### Listing Atom updates |
271 |
| - |
272 |
| -#### GET /api/updates |
273 |
| - |
274 |
| -Atom update feed, following the format expected by [Squirrel](https://github.com/Squirrel/). |
275 |
| - |
276 |
| -Returns: |
277 |
| - |
278 |
| -```json |
279 |
| -{ |
280 |
| - "name": "0.96.0", |
281 |
| - "notes": "[HTML release notes]", |
282 |
| - "pub_date": "2014-05-19T15:52:06.000Z", |
283 |
| - "url": "https://www.atom.io/api/updates/download" |
284 |
| -} |
285 |
| -``` |
| 3 | +The information that was here has been moved to [a permanent home inside Atom's Flight Manual.](https://flight-manual.atom.io/atom-server-side-apis/) |
0 commit comments