The Fifth World

Create a new page

This endpoint allows you to create a new page.

Request

HTTP Headers
HTTP Header Value
Authorization A valid JSON Web Token, of the form Bearer ENCODEDHEADER.ENCODEDPAYLOAD.ENCODEDSIGNATURE. Only authenticated members can use this endpoint.
Body Parameters
Request Body Data Value Type Value
title string The title of the page.
description string A description of the page. This should not exceed 280 characters.
slug string A string suitable for use in a URL. If not provided, this endpoint generates one autoamtically based on the title (e.g., North America becomes north-america).
parent string The unique path of another, existing page. If provided, this endpoint creates a child of the given page. If not provided, then the new page has no parent, making it a root page.
path string A unique path for the page. If not provided, the endpoint generates one automatically by taking the parent’s path and appending / and the page’s slug. If this does not result in a unique path, or if you provide a path that some other page already has, the endpoint returns a 400 HTTP error.
body string The content of the page.
type string The page’s type. If not supplied, the endpoint looks for a substring of the form [[Type:X]] within the body and makes X the type. If you do not supply any type using this parameter, and the body does not specify any type, then the new page will not have any type. Note that any value supplied through this parameter will take precedence over any type specified in the body.
files object This object must have a file property. If that provides an image file, you may also include a thumbnail property. Both provide File objects (see below).
permissions number The permissions to set on the new page. This three-digit code uses the same conventions as Unix permissions, with the owner understood as the person who created the page, the group understood as authenticated members of the Fifth World, and the world understood as the general public. Pages default to 774, meaning that any authenticated member of the Fifth World can edit them, and anyone in the world can read them. A hidden page has a value of 700, allowing its owner to see and edit it, but no one else. A locked page has a value of 444, allowing anyone to see it, but only administrators to edit it.
File Object
Property Value Type Value
name string The file’s name (e.g., example.txt).
data Buffer A Buffer containing the actual binary data of the file.
size number The file’s size in bytes.
encoding string A string that specifies the file’s encoding.
mimetype string The file’s MIME type (e.g., text/plain).
md5 string An MD5 hash of the file.

Examples

Example Request
POST /v1/pages HTTP/1.1 Host: api.thefifthworld.com Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c { "title": "New Page", "description": "A new page that doesn’t exist yet.", "body": "This page provides an example of how to use the POST /pages endpoint of the Fifth World Pages API to create a new page." }

Response

If you try to use this endpoint without supplying a valid JSON Web Token to authenticate, it responds with a 401 HTTP error. If you authenticate, but the endpoint runs into an error in creating the page (for example, if you specify a path already in use, or if the automatically-generated path belongs to an existing page), it responds with a 400 HTTP error. If the endpoint successfully creates the page, though, it responds with a 200 HTTP response and a JSON body detailing the page it just created.

Page Object
Property Value Type Value
id number The page’s unique numerical ID.
title string The title of the page.
description string The page’s description. It appears in the page’s header provided to search engines, social media, and other such bots and spiders.
slug string A string used to create the page’s unique path.
path string The unique path of this page on the Fifth World website. If you add https://thefifthworld.com to the front of this string, you’ll have its URL. By default, we create this string by taking the path of the page’s parent and appending a / and the page’s own slug to it.
parent number The unique numerical ID of this page’s parent page. If equal to 0, that means that this page does not have a parent.
data object Any structured data associated with the current version fo the page.
depth number How “deep” the page appears in the overall page hierarchy. A page that has no parent has a depth of 0. Such a page’s child would have a depth of 1, and if that page has a child, its depth will equal 2. If you wanted to trace the lineage of a page back to a “root” page that has no parents, this number tells you how many pages you will need to trace to get there.
permissions number The permissions set on the page. This three-digit code uses the same conventions as Unix permissions, with the owner understood as the person who created the page, the group understood as authenticated members of the Fifth World, and the world understood as the general public. Pages default to 774, meaning that any authenticated member of the Fifth World can edit them, and anyone in the world can read them. A hidden page has a value of 700, allowing its owner to see and edit it, but no one else. A locked page has a value of 444, allowing anyone to see it, but only administrators to edit it.
type string The page’s type.
tags object An object that provides the key/value pairs of the page’s tags.
location object or boolean If a page has a location associated with it (as pages of type Place should), this property provides an object, which itself provides two properties, both numbers: lat (which provides the location’s latitude) and lon (which provides the location’s longitude). If a page does not have any location associated with it, this property equals false.
likes array This property provides an array of the unique member ID’s of everyone who has liked this page.
files array This property provides an array of File objects (see below).
owner object The page’s owner (the person who first created it). This object includes properties id (the member’s unique numerical ID) and name (the string that this member has provided for hens name).
history array This property provides an array of Change objects (see below), providing the history of changes made to this page.
lineage array This property includes an array of this page’s “ancestors,” so if this page has a parent, a Page object for that page will appear in this array, and if that page has a parent, a Page object for its parent will also appear in the array. The “root” page (the one that has no parent of its own) appears first, and the page’s direct parent comes last. If the page has no parent, then you will find an empty array here.
File Object
Property Value Type Value
name string The unique key used to find the file on the CDN.
thumbnail string The unique key used to find the file’s thumbnail on the CDN. Only images have thumbnails.
mime string The MIME type of this file.
size number The file’s size in bytes.
readableSize string The file’s size, parsed into a human-readable string (e.g., if size equals 104,864, then readableSize will equal 104.9 kB).
page number The unique numerical ID of the page this file belongs to.
timestamp number When the uploader uploaded this file, presented as a Unix Epoch timestamp (the number of seconds since midnight on 1 January 1970 UTC).
uploader number The unique numerical ID of the member who uploaded this file.
urls object An object with two properties: full (providing the URL from which you can access the full file on the CDN) and thumbnail (providing the URL from which you can access the thumbnail on the CDN). Only images have thumbnails.
Change Object
Property Value Type Value
id number A unique numerical ID for this change.
timestamp string The time when this change happened.
msg string The commit message that the editor provided to explain the change and why hen made it.
content object An object providing the content of the changes made. Many of these properties map to those in the Page object, but they usually include the body property as well. This property includes the unparsed wikitext of the page. When you view the page, the content displayed comes from the body property of the most recent change made, parsed into HTML.
editor object An object with two properties: id (the unique numerical ID of the member who made this change) and name (the name that the member who made this change provided for henself).

Example

Example Response
{ "id": 999999, "title": "New Page", "description": "A new page that doesn’t exist yet.", "slug": "new-page", "path": "/new-page", "parent": 0, "depth": 0, "permissions": 774, "type": null, "tags": {}, "location": false, "likes": [], "files": [], "owner": { "id": 9999, "name": "You" }, "history": [ { "id": 99999999, "timestamp": "2020-10-11T20:09:28.000Z", "msg": "Initial text", "content": { "title": "New Page", "path": "/new-page", "body": "This page provides an example of how to use the POST /pages endpoint of the Fifth World Pages API to create a new page.", "description": "A new page that doesn’t exist yet." }, "editor": { "name": "You", "id": 9999 } } ] }