Skip to content
This repository was archived by the owner on Aug 4, 2018. It is now read-only.

Packages route

Fingercomp edited this page Feb 20, 2017 · 7 revisions

The /packages route supports the following request methods: GET, POST.

Package list

Send the GET request to /packages. The query parameters are:

Name Type Comment
offset Integer, optional Zero-based offset from the beginning of the list.

See the package search page for additional parameters.

Responses

Status Comment
200 OK
Request Response
GET /packages HTTP/1.1
...
HTTP/1.1 200 OK
...

{"success": true, "code": 200, "title": "OK", "logged_in": false, "version": "...", "data": { "offset": 0, "total": 150, "sent": 20, "truncated": true, "list": [ {"name": "...", "description": "...", ...}, ... ] } }

GET /packages?offset=120 HTTP/1.1
...
HTTP/1.1 200 OK
...

{"success": true, "code": 200, "title": "OK", "logged_in": false, "version": "...", "data": { "offset": 120, "total": 150, "sent": 20, "truncated": true, "list": [ {"name": "...", "description": "...", ...}, ... ] } }

Create a package

Requires authorization. Has an ACE.

Send a POST request to /packages.

Request body

{"name": "The name of the package",
 "description": "The description of the package",
 "short_description": "The short (up to 140 characters, will be truncated if a longer string sent) description of the package.",
 "authors": [
   "Program author 1",
   "Program author 2"
 ],
 "owners": [
   "user-1",
   "user-2"
 ],
 "license": "Package license, e.g., GPL v3",
 "tags": [
   "tag 1",
   "tag 2",
   "tag 3"
 ],
 "versions": {
   "1.0.0": {
     "files": {
       "http://example.com/file1": {
         "path": "/usr/bin/program.lua"
       },
       "http://example.com/file2": {
         "path": "/usr/lib/libprogram.lua"
       },
       ...
     },
     "depends": {
       "dependency-1": {"type": "recommended", "version": ">2,<2.3.2"},
       ...
     }
   },
   ...
 },
 "screenshots": {
   "http://example.com/image-1.png": "Description of the image",
   ...
 }
}

See the package model page for more details.

Responses

Status Comment
201 Created Package created.
400 Bad Request Bad package data.
409 Conflict Name conflict: package with the given name already exists.
Request Response
POST /packages HTTP/1.1
Cookie: ...
...

{"name": "The name of the package", "description": "The description of the package", "short_description": "The short description.", "authors": [ "Program author 1", "Program author 2" ], "owners": [ "user-1", "user-2" ], "license": "Package license, e.g., GPL v3", "tags": [ "tag 1", "tag 2", "tag 3" ], "versions": { "1.0.0": { "files": { "http://example.com/file1": { "path": "/usr/bin/program.lua" }, "http://example.com/file2": { "path": "/usr/lib/libprogram.lua" } }, "depends": { "dependency-1": { "type": "recommended", "version": ">2,<2.3.2" } } } }, "screenshots": { "http://example.com/image-1.png": "Img" } }

HTTP/1.1 201 Created
...

{"success": true, "code": 201, ...}

Changes

Version Changes
3.3.0 Deprecated dir and name. Added path.
3.1.0 Now checks for JSON validity.
3.0.0 Renamed data.data to data.list (Packages:GET).

See Also