POST /api/v1/publications publishes a collection of custom game levels: a
format, a title, a JSON document of up to 256 KiB and a visibility of
public, friends or private. Sending its id replaces one of your own, while
anyone else's answers 404 so a publication's existence never leaks. An
account keeps at most 100 publications and their documents count toward its
storage.
GET /api/v1/publications lists the newest public publications, or with
author (an alias or account ID) the ones that author lets you see: public
ones, friends-only ones for friends, and private ones for the author alone.
Either listing can keep one format. GET /api/v1/publications/{id} returns a
visible publication with its document, and DELETE lets its author
unpublish it. Publishing is limited to 60 changes an hour and reading to 120
requests a minute per account.
56 lines
4.2 KiB
JSON
56 lines
4.2 KiB
JSON
{
|
|
"/api/v1/publications": {
|
|
"get": {
|
|
"summary": "Find published level collections",
|
|
"description": "Requires the account bearer. Without author, lists the newest public publications. With author (alias, @alias or 64-hex public ID), lists that author's publications the caller may see: public ones, friends-only ones when the caller is the author's friend, and private ones only for the author; an unknown author has none. format keeps one document format. Newest updated first, at most 50. Each publication is {id, author {alias, public_id}, format, title, levels, visibility, updated_at, mine}. Limited to 120 reads a minute per account.",
|
|
"parameters": [
|
|
{"name": "format", "in": "query", "required": false, "schema": {"type": "string", "pattern": "^[a-z0-9.-]{1,64}$"}},
|
|
{"name": "author", "in": "query", "required": false, "schema": {"type": "string"}}
|
|
],
|
|
"responses": {
|
|
"200": {"description": "publications array; no-store"},
|
|
"400": {"description": "Invalid format"},
|
|
"401": {"description": "Account authentication required"},
|
|
"429": {"description": "Too many reads"}
|
|
}
|
|
},
|
|
"post": {
|
|
"summary": "Publish or replace a level collection",
|
|
"description": "Requires the account bearer. document is an opaque JSON object of at most 262144 bytes; levels counts its top-level levels array. visibility is public, friends (the author's friends) or private (the author alone). Without id this creates a publication with a new id; with id it replaces the format, title, visibility and document of the caller's own publication, and anyone else's answers 404. An account keeps at most 100 publications, and documents count toward its storage. Publishing and unpublishing are limited to 60 an hour per account.",
|
|
"requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "required": ["format", "title", "visibility", "document"], "properties": {"id": {"type": "string", "pattern": "^[0-9a-f]{32}$"}, "format": {"type": "string", "pattern": "^[a-z0-9.-]{1,64}$"}, "title": {"type": "string", "description": "1 to 80 bytes of UTF-8 without control characters"}, "visibility": {"type": "string", "enum": ["public", "friends", "private"]}, "document": {"type": "object"}}}}}},
|
|
"responses": {
|
|
"200": {"description": "The publication's metadata; no-store"},
|
|
"400": {"description": "Invalid format, title, visibility or document"},
|
|
"401": {"description": "Account authentication required"},
|
|
"404": {"description": "No publication of the caller's has this id"},
|
|
"413": {"description": "Document too large, 100 publications already, or the account storage limit reached (code storage_full)"},
|
|
"429": {"description": "Too many publishing changes"}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/publications/{id}": {
|
|
"get": {
|
|
"summary": "Fetch a publication and its document",
|
|
"description": "Requires the account bearer. Returns {publication, document} when the caller may see it under its visibility; otherwise 404, so a publication's existence never leaks. Limited to 120 reads a minute per account.",
|
|
"parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "pattern": "^[0-9a-f]{32}$"}}],
|
|
"responses": {
|
|
"200": {"description": "Publication metadata and the stored document; no-store"},
|
|
"401": {"description": "Account authentication required"},
|
|
"404": {"description": "Missing or not visible to the caller"},
|
|
"429": {"description": "Too many reads"}
|
|
}
|
|
},
|
|
"delete": {
|
|
"summary": "Unpublish a publication",
|
|
"description": "Requires the account bearer. Only the author may delete a publication; anyone else's and missing ids answer 404.",
|
|
"parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string", "pattern": "^[0-9a-f]{32}$"}}],
|
|
"responses": {
|
|
"200": {"description": "deleted true; no-store"},
|
|
"401": {"description": "Account authentication required"},
|
|
"404": {"description": "No publication of the caller's has this id"},
|
|
"429": {"description": "Too many publishing changes"}
|
|
}
|
|
}
|
|
}
|
|
}
|